From 03a5539fd75dd5bd037ae055ebec7c30990e424f Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sat, 17 Jun 2023 00:21:49 +0200 Subject: [PATCH] extrahd.cgi: Add is_configured function. 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 bb0c226102..4db540aae4 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.5