]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/extrahd.cgi
Merge branch 'core157'
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / extrahd.cgi
index 86b0de5c37e6cfff31d2f87ca064f025bf73ddc7..154efd7b28678d1b1d10800a35997d300948072c 100644 (file)
@@ -48,8 +48,13 @@ my $partitionentry = "";
 my $devicefile = "/var/ipfire/extrahd/devices";
 my $scanfile = "/var/ipfire/extrahd/scan";
 my $partitionsfile = "/var/ipfire/extrahd/partitions";
-system("/usr/local/bin/extrahdctrl scanhd ide");
-system("/usr/local/bin/extrahdctrl scanhd partitions");
+
+#workaround to suppress a warning when a variable is used only once
+my @dummy = ( ${Header::colourgreen}, ${Header::colourred} );
+undef (@dummy);
+
+&General::system("/usr/local/bin/extrahdctrl", "scanhd", "ide");
+&General::system("/usr/local/bin/extrahdctrl", "scanhd", "partitions");
 
 &Header::showhttpheaders();
 
@@ -93,12 +98,12 @@ if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'})
 UUID=$extrahdsettings{'UUID'};$extrahdsettings{'FS'};$extrahdsettings{'PATH'};
 END
 ;
-       system("/usr/local/bin/extrahdctrl mount $extrahdsettings{'PATH'}");
+       &General::system("/usr/local/bin/extrahdctrl", "mount", "$extrahdsettings{'PATH'}");
        }
 } 
 elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) 
 {
-       if ( `/usr/local/bin/extrahdctrl umount $extrahdsettings{'PATH'}` ) {
+       if ( &General::system("/usr/local/bin/extrahdctrl", "umount", "$extrahdsettings{'PATH'}")) {
                open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
                @tmp = <FILE>;
                close FILE;
@@ -127,7 +132,6 @@ if ($errormessage) {
 ############################################################################################################################
 ############################################################################################################################
 
-&Header::openbox('100%', 'center', $Lang::tr{'extrahd'});
        open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
        @devices = <FILE>;
        close FILE;
@@ -139,7 +143,11 @@ END
        {
                @deviceline = split( /\;/, $deviceentry );
                my $color="$Header::colourred";
-               if ( ! `/bin/mountpoint $deviceline[2] | grep " not "`  ) {
+
+               # Use safe system_output to get mountpoint details.
+               my @mountpoint = &General::system_output("/bin/mountpoint", "$deviceline[2]");
+
+               if ( ! grep(/not/, @mountpoint)) {
                        $color=$Header::colourgreen;
                }
                print <<END
@@ -152,8 +160,8 @@ END
                                                <input type='hidden' name='DEVICE' value='$deviceline[0]' />
                                                <input type='hidden' name='FS' value='$deviceline[1]' />
                                                <input type='hidden' name='PATH' value='$deviceline[2]' />
-                                               <input type='hidden' name='ACTION' value=$Lang::tr{'delete'} />
-                                               <input type='image' alt=$Lang::tr{'delete'} src='/images/delete.gif' />
+                                               <input type='hidden' name='ACTION' value='$Lang::tr{'delete'}' />
+                                               <input type='image' alt='$Lang::tr{'delete'}' title='$Lang::tr{'delete'}' src='/images/delete.gif' />
                                        </form></td></tr>
 END
 ;
@@ -162,9 +170,6 @@ END
                </table>
 END
 ;
-
-&Header::closebox();
-
 &Header::openbox('100%', 'center', $Lang::tr{'extrahd detected drives'});
        print <<END
                <table border='0' width='600' cellspacing="0">
@@ -227,8 +232,8 @@ END
                                <td align="center">
                                        <input type='hidden' name='DEVICE' value='$partitionline[0]' />
                                        <input type='hidden' name='UUID' value='$partitionline[2]' />
-                                       <input type='hidden' name='ACTION' value=$Lang::tr{'add'} />
-                                       <input type='image' alt=$Lang::tr{'add'} src='/images/add.gif' />
+                                       <input type='hidden' name='ACTION' value='$Lang::tr{'add'}' />
+                                       <input type='image' alt='$Lang::tr{'add'}' title='$Lang::tr{'add'}' src='/images/add.gif' />
                                </form></td></tr>
 END
 ;