X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fextrahd.cgi;h=86b0de5c37e6cfff31d2f87ca064f025bf73ddc7;hb=12a8cc1ed90b108fbbcb2d1093e754f05e98bdc1;hp=89f2eea5e64ae2059a909c0072e3dd0031de86aa;hpb=f2fdd0c1e9a3ccf539cd477a6111281eadc200a7;p=people%2Fteissler%2Fipfire-2.x.git diff --git a/html/cgi-bin/extrahd.cgi b/html/cgi-bin/extrahd.cgi index 89f2eea5e..86b0de5c3 100644 --- a/html/cgi-bin/extrahd.cgi +++ b/html/cgi-bin/extrahd.cgi @@ -1,16 +1,28 @@ #!/usr/bin/perl -# -# IPFire CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The IPFire Team -# +############################################################################### +# # +# IPFire.org - A linux based firewall # +# 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 # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### use strict; # enable only the following on debugging purpose -use warnings; -use CGI::Carp 'fatalsToBrowser'; +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; @@ -36,8 +48,8 @@ my $partitionentry = ""; my $devicefile = "/var/ipfire/extrahd/devices"; my $scanfile = "/var/ipfire/extrahd/scan"; my $partitionsfile = "/var/ipfire/extrahd/partitions"; -system("/usr/local/bin/scanhd ide"); -system("/usr/local/bin/scanhd partitions"); +system("/usr/local/bin/extrahdctrl scanhd ide"); +system("/usr/local/bin/extrahdctrl scanhd partitions"); &Header::showhttpheaders(); @@ -46,6 +58,7 @@ $extrahdsettings{'PATH'} = ''; $extrahdsettings{'FS'} = ''; $extrahdsettings{'DEVICE'} = ''; $extrahdsettings{'ACTION'} = ''; +$extrahdsettings{'UUID'} = ''; &General::readhash("${General::swroot}/extrahd/settings", \%extrahdsettings); &Header::getcgihash(\%extrahdsettings); @@ -66,18 +79,18 @@ 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'}."; } } if ( "$ok" eq "true" ) { open(FILE, ">> $devicefile" ) or die "Unable to write $devicefile"; print FILE <; close FILE; @@ -126,14 +139,14 @@ END { @deviceline = split( /\;/, $deviceentry ); my $color="$Header::colourred"; - if ( `/bin/mount | /bin/fgrep $deviceline[2] | /bin/fgrep /dev/$deviceline[0]` ) { + if ( ! `/bin/mountpoint $deviceline[2] | grep " not "` ) { $color=$Header::colourgreen; } print <  - /dev/$deviceline[0] - $deviceline[1] - $deviceline[2] +   + $deviceline[0] + $deviceline[1] + $deviceline[2]
@@ -141,7 +154,7 @@ END -
+ END ; } @@ -152,7 +165,7 @@ END &Header::closebox(); -&Header::openbox('100%', 'center', 'Gefundene Laufwerke'); +&Header::openbox('100%', 'center', $Lang::tr{'extrahd detected drives'}); print < END @@ -166,21 +179,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 ; } @@ -189,25 +207,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 < - /dev/$partitionline[0] - $Lang::tr{'size'} $size MB - + - - + + + - + +END +; END ; @@ -216,7 +240,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 ;