X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fextrahd.cgi;h=da1efb2ddff23245887643be8a3fcc60c4ae7ba0;hb=deffc27598806b43ae03a4fb666f2f0254a94066;hp=b9f42abe9649bf90fb6e733403d885d6f4cf102a;hpb=e528205ed8534cec2c29c0932108d98570c7f07a;p=ipfire-2.x.git diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index b9f42abe96..da1efb2ddf 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2010 IPFire Team # +# Copyright (C) 2011 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -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); + +system("/usr/local/bin/extrahdctrl scanhd ide >/dev/null"); +system("/usr/local/bin/extrahdctrl scanhd partitions >/dev/null"); &Header::showhttpheaders(); @@ -79,11 +84,11 @@ if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'}) @deviceline = split( /\;/, $deviceentry ); if ( "$extrahdsettings{'PATH'}" eq "$deviceline[2]" ) { $ok = "false"; - $errormessage = "You can't mount $extrahdsettings{'DEVICE'} to $extrahdsettings{'PATH'}, because there is already a device mounted."; + $errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd because there is already a device mounted'}."; } if ( "$extrahdsettings{'PATH'}" eq "/" ) { $ok = "false"; - $errormessage = "You can't mount $extrahdsettings{'DEVICE'} to root /."; + $errormessage = "$Lang::tr{'extrahd you cant mount'} $extrahdsettings{'DEVICE'} $Lang::tr{'extrahd to root'}."; } } @@ -113,7 +118,7 @@ elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'}) } close FILE; } else { - $errormessage = "Can't umount $extrahdsettings{'PATH'}. Maybe the device is in use?"; + $errormessage = "$Lang::tr{'extrahd cant umount'} $extrahdsettings{'PATH'}$Lang::tr{'extrahd maybe the device is in use'}?"; } } @@ -127,7 +132,6 @@ if ($errormessage) { ############################################################################################################################ ############################################################################################################################ -&Header::openbox('100%', 'center', $Lang::tr{'extrahd'}); open( FILE, "< $devicefile" ) or die "Unable to read $devicefile"; @devices = ; close FILE; @@ -139,22 +143,22 @@ END { @deviceline = split( /\;/, $deviceentry ); my $color="$Header::colourred"; - if ( `/bin/mountpoint $deviceline[2]` ) { + if ( ! `/bin/mountpoint $deviceline[2] | grep " not "` ) { $color=$Header::colourgreen; } print <  - $deviceline[0] - $deviceline[1] - $deviceline[2] +   + $deviceline[0] + $deviceline[1] + $deviceline[2]
- -
+ + END ; } @@ -162,9 +166,6 @@ END END ; - -&Header::closebox(); - &Header::openbox('100%', 'center', $Lang::tr{'extrahd detected drives'}); print < @@ -179,21 +180,26 @@ END foreach $scanentry (sort @scans) { @scanline = split( /\;/, $scanentry ); - print <  - /dev/$scanline[0] - $scanline[1] + # remove wrong entries like usb controller name + if ($scanline[1] ne "\n") + { + print <  + /dev/$scanline[0] + $scanline[1] END ; + + } foreach $partitionentry (sort @partitions) { @partitionline = split( /\;/, $partitionentry ); if ( "$partitionline[0]" eq "$scanline[0]" ) { $size = int($partitionline[1] / 1024); print <$Lang::tr{'size'} $size MB -   -   + $Lang::tr{'size'} $size MB +   +   END ; } @@ -202,28 +208,31 @@ END foreach $partitionentry (sort @partitions) { @partitionline = split( /\;/, $partitionentry ); - if (( "$partitionline[0]" =~ /^$scanline[0]/ ) && ! ( "$partitionline[0]" eq "$scanline[0]" )) { + if (( "$partitionline[0]" =~ /^$scanline[0]/ ) && !( "$partitionline[2]" eq "" )) { $size = int($partitionline[1] / 1024); print < - UUID=$partitionline[2] + UUID=$partitionline[2] /dev/$partitionline[0] - $Lang::tr{'size'} $size MB + $Lang::tr{'size'} $size MB - + + - - + + +END +; END ; @@ -232,7 +241,9 @@ END } print <If your device isn't listed here, you need to install or load the driver.
If you can see your device but no partitions you have to create them first. +   +   + $Lang::tr{'extrahd install or load driver'} END ;