From mboxrd@z Thu Jan 1 00:00:00 1970 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> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8471750217676339167==" List-Id: --===============8471750217676339167== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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"); + } +} -- 2.39.2 --===============8471750217676339167==--