From patchwork Tue Aug 1 15:48:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 7052 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4RFffs3Xfjz3wmm for ; Tue, 1 Aug 2023 15:49:09 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4RFffm4XVnz1gn; Tue, 1 Aug 2023 15:49:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4RFffm454yz2yV9; Tue, 1 Aug 2023 15:49:04 +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 4RFffl6t1Mz2xgB for ; Tue, 1 Aug 2023 15:49:03 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4RFffj6MsfzW2; Tue, 1 Aug 2023 15:49:01 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1690904942; 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=3l/+ixKOtQP7WwaWMjsaOmjumffB7vALDDS/TZBQp1s=; b=WX8rD+f79LQ6LdcIFbjDEfRDnY1zwZWhpFl5qCu3bZ2IDvh9D6uZKcOxG/YLXCZh66lB5B r0Tg3cDnXG+ElMAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1690904942; 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=3l/+ixKOtQP7WwaWMjsaOmjumffB7vALDDS/TZBQp1s=; b=BzQ3cTkNDce+xGE77VYxEAPhcapBxJm91HC69Byc5yQ4ZDZn4Bb7DfwKzUiii4xE4lS+5N 76lF9AJSl9dpZ4xtB23htkin+UbiMYhubapAP9mNyMpvFzOc8tNY1IJ8IWExkx8I2iozSz I9UBZZOBnavLoP1L35NlpQn3DXh1deM46b8AjAxGqx6i2Z5DrD+y5OSjgJHCVn6nTT6xHs zUnwkNQKIU41Jt5Y/ur00oSovdWJZ6JYGLApk6KgbXzfSRlKln88//QR2Mj129fSUtTN3p ATAbicw3/K3v0qaG/BWewZnX690Dp3nkNu3K0UXdpt/B5svbc8fPipxboytE8g== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCHv2 05/12] extrahd.cgi: Add is_configured function. Date: Tue, 1 Aug 2023 17:48:32 +0200 Message-Id: <20230801154839.2373-5-stefan.schantl@ipfire.org> In-Reply-To: <20230801154839.2373-1-stefan.schantl@ipfire.org> References: <20230801154839.2373-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 Reviewed-by: Bernhard Bitsch --- 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 bb0c22610..4db540aae 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"); + } +}