]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/usb/getdiskinfo
Update
[bacula/rescue] / rescue / linux / usb / getdiskinfo
index 75ec6556adfe313925e6816c077df19e387fcedb..9a692670707b873d94c6e41fc1b7cc7c9e66790a 100755 (executable)
@@ -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-`