From patchwork Fri Jun 23 04:01:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6950 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QnNpZ2XFxz3wjw for ; Fri, 23 Jun 2023 04:01:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QnNpW2CPGz2ST; Fri, 23 Jun 2023 04:01:39 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QnNpW0SJ1z30Bj; Fri, 23 Jun 2023 04:01:39 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QnNpT4fzPz2yp4 for ; Fri, 23 Jun 2023 04:01:37 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QnNpS6qfBz1Np; Fri, 23 Jun 2023 04:01:36 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1687492897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bIf9mZxwPJcu7fSSSUKU8hQOtO88PEvHwO7Vedw8wfE=; b=mNY7NQsWn8O0by/XTUJVX/Ou3tl6N0oval1PzM7DWfbGatrtjQrW/MieLLR20Ox1MjXuTh m89SSYPwtXdTV7Ag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1687492897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bIf9mZxwPJcu7fSSSUKU8hQOtO88PEvHwO7Vedw8wfE=; b=CyLj9barAqiov0KozOZP707JPsT2fx/qi7y41oA9/PoVyG/3cFl02SW00F49AHnosJwPXL JiZWFwvpYDzlqkzakuX+gQQK2WYDrtbD7Qc8w1w6NxFbp1azYkiYaeqsjn+XV5dN5bk4Ja xusHV5TXuNm2DGU8anU5mZZCir1xOp75XY4BvScJLaLxSqnxN8J3JXw5DeVyEg77lYZ/8w YIN/4FnXAse7Li4/ky+UFP4dZPh5wxu95Dn161H2YdGa6Aay3y2YfW25xEuH+BpjOOgXgM HSl7j6KeugpkapPcmzhbt67Rk2TtatJ+J3bYVjitfoQtw7mww493uHdakVVHdQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 5/8] extrahd.cgi: Add is_configured function. Date: Fri, 23 Jun 2023 06:01:21 +0200 Message-Id: <20230623040124.3826-5-stefan.schantl@ipfire.org> In-Reply-To: <20230623040124.3826-1-stefan.schantl@ipfire.org> References: <20230623040124.3826-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- html/cgi-bin/extrahd.cgi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index fc8685830..533d0cdce 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -690,3 +690,15 @@ sub is_swap ($) { return 1 if(grep /$device/, @swaps); } + +# +## Returns "True" if a drive is a configured one. +# +sub is_configured ($) { + my ($path) = @_; + + # Loop through the hash of configured drives. + foreach my $uuid (keys %configured_drives) { + return 1 if($configured_drives{$uuid} eq "$path"); + } +}