mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
extrahd: Use UUID instead of device nodes.
This commit is contained in:
@@ -57,10 +57,10 @@ if ( "$ARGV[0]" eq "mount" ) {
|
||||
{
|
||||
@deviceline = split( /\;/, $deviceentry );
|
||||
if ( "$ARGV[1]" eq "$deviceline[2]" ) {
|
||||
print "Insert /dev/$deviceline[0] ($deviceline[1]) --> $deviceline[2] into /etc/fstab!\n";
|
||||
print "Insert $deviceline[0] ($deviceline[1]) --> $deviceline[2] into /etc/fstab!\n";
|
||||
unless ( -d $deviceline[2] ) { system("/bin/mkdir -p $deviceline[2] && chmod 0777 $deviceline[2]"); }
|
||||
open(FILE, ">>$fstab");
|
||||
print FILE "/dev/$deviceline[0]\t$deviceline[2]\t$deviceline[1]\tdefaults\t0\t0\n";
|
||||
print FILE "$deviceline[0]\t$deviceline[2]\t$deviceline[1]\tdefaults\t0\t0\n";
|
||||
close(FILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ $extrahdsettings{'PATH'} = '';
|
||||
$extrahdsettings{'FS'} = '';
|
||||
$extrahdsettings{'DEVICE'} = '';
|
||||
$extrahdsettings{'ACTION'} = '';
|
||||
$extrahdsettings{'UUID'} = '';
|
||||
|
||||
&General::readhash("${General::swroot}/extrahd/settings", \%extrahdsettings);
|
||||
&Header::getcgihash(\%extrahdsettings);
|
||||
@@ -89,7 +90,7 @@ if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'})
|
||||
if ( "$ok" eq "true" ) {
|
||||
open(FILE, ">> $devicefile" ) or die "Unable to write $devicefile";
|
||||
print FILE <<END
|
||||
$extrahdsettings{'DEVICE'};$extrahdsettings{'FS'};$extrahdsettings{'PATH'};
|
||||
UUID=$extrahdsettings{'UUID'};$extrahdsettings{'FS'};$extrahdsettings{'PATH'};
|
||||
END
|
||||
;
|
||||
system("/usr/local/bin/extrahdctrl mount $extrahdsettings{'PATH'}");
|
||||
@@ -138,12 +139,12 @@ 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]` ) {
|
||||
$color=$Header::colourgreen;
|
||||
}
|
||||
print <<END
|
||||
<tr><td colspan="5">
|
||||
<tr><td align='center'><font color=$color><b>/dev/$deviceline[0]</b></font>
|
||||
<tr><td align='center'><font color=$color><b>$deviceline[0]</b></font>
|
||||
<td align='center'>$deviceline[1]
|
||||
<td align='center'>$deviceline[2]
|
||||
<td align='center'>
|
||||
@@ -217,6 +218,7 @@ END
|
||||
<td align="center"><input type='text' name='PATH' value=/mnt/harddisk />
|
||||
<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' />
|
||||
</form>
|
||||
|
||||
@@ -5,7 +5,11 @@ case "$1" in
|
||||
/sbin/kudzu -qps -c HD | egrep "desc|device:" | awk -F': ' '{print $2}' | sed -e '/"$/a\\' -e "s/$/\;/g" | tr "\n" "XX" | sed -e "s/XX/\n/g" -e "s/\;X/\;/g" > /var/ipfire/extrahd/scan
|
||||
;;
|
||||
partitions)
|
||||
cat /proc/partitions | awk '{print $4 ";" $3 ";"}' | grep -v name | grep -v "^;;$" > /var/ipfire/extrahd/partitions
|
||||
cat /proc/partitions | awk '{print $4 " " $3 }' | grep -v name | grep -v "^[:space:]*$" | \
|
||||
while read device size; do
|
||||
[ -z "${device}" ] && continue
|
||||
echo "${device};${size};$(blkid -s UUID -o value /dev/${device});"
|
||||
done > /var/ipfire/extrahd/partitions
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 (ide|partitions)"
|
||||
|
||||
Reference in New Issue
Block a user