X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=rescue%2Flinux%2Fusb%2Fgetdiskinfo;h=9a692670707b873d94c6e41fc1b7cc7c9e66790a;hb=708436ba5ce5d0913bc302720089fef4cc2f5b21;hp=75ec6556adfe313925e6816c077df19e387fcedb;hpb=5fa1e7c63be2c5b2ec292956ea52fde0521fa242;p=bacula%2Frescue diff --git a/rescue/linux/usb/getdiskinfo b/rescue/linux/usb/getdiskinfo index 75ec655..9a69267 100755 --- a/rescue/linux/usb/getdiskinfo +++ b/rescue/linux/usb/getdiskinfo @@ -1,18 +1,26 @@ #!/bin/sh # # Create bootstrap information files -- prelude to creating a -# Bacula Rescue Disk +# Bacula Rescue data for USB key # # Kern Sibbald, December MMII -# This source distributed under the GPL +# This source distributed under the GPLv2 # export LANG=C cwd=`pwd` -host=`uname -s` -di=${cwd}/diskinfo -scr=${cwd}/scripts +os=`uname -s` +if [ ! "x$1" = "x" ] ; then + host=$1 +else + host=`hostname` +fi +echo "Host specific data will be saved in the directory: ${host}" +echo " " +mkdir -p $host +di=${cwd}/$host/diskinfo +scr=${cwd}/$host/scripts -case $host in +case $os in Linux) ;; FreeBSD | SunOS | IRIX) @@ -22,15 +30,15 @@ case $host in ;; *) echo "" - echo "Unknown operating system type: $host" + echo "Unknown operating system type: $os" exit 1 ;; esac if [ ! `whoami` = "root" ] ; then echo "" - echo "You need to be root to run this, otherwise" - echo "sfdisk produces no output. Continuing anyway ..." + echo "You need to be root to run this script ..." echo "" + exit 1 fi # @@ -47,7 +55,8 @@ mount -l -t reiserfs >mount.rei.bsi cp /etc/fstab fstab.bsi cp /etc/mtab mtab.bsi df -Tl >df.bsi -sfdisk -s >sfdisk.disks.bsi +# Pickup all disks except USB_DEV +sfdisk -s | grep -v "${USB_DEV}" >sfdisk.disks.bsi grep "^/dev/" sfdisk.disks.bsi | sed -n 's%\(^/dev/[A-Za-z]*\):.*$%\1%p' >disks.bsi for i in `cat disks.bsi`; do j=`echo $i | cut -c6-`