]> git.sur5r.net Git - bacula/rescue/blobdiff - rescue/linux/oldusb/write_disk_info_to_usb
Move usb to oldusb
[bacula/rescue] / rescue / linux / oldusb / write_disk_info_to_usb
diff --git a/rescue/linux/oldusb/write_disk_info_to_usb b/rescue/linux/oldusb/write_disk_info_to_usb
new file mode 100755 (executable)
index 0000000..b5374b3
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# write the disk info from the current system to the USB
+#  stick.  We write it in the home-rw partition
+#
+. ./config
+
+if [ ! `whoami` = "root" ] ; then
+  echo ""
+  echo "You need to be root to run this shell script"
+  echo ""
+  exit 1
+fi
+
+echo " "
+echo "This script will write your current system information to the USB"
+echo "stick in the home-rw partition (/home/ubuntu)"
+
+if [ ! -d ${MOUNT_POINT}/home-rw ] ; then
+   mount ${USB_DEV}3 ${MOUNT_POINT}/home-rw
+fi
+if [ ! -d ${MOUNT_POINT}/home-rw ] ; then
+  echo "Mount of home-rw USB partition failed."
+  echo "Please pre-mount the USB stick and run this script again."
+  exit 1
+fi
+cd ${MOUNT_POINT}/home-rw
+if [ $? -ne 0 ] ; then
+  echo "Could not cd to home-rw USB partition"
+  exit 1
+fi
+
+mkdir -p ubuntu
+chown 1000:1000 ubuntu
+cd ubuntu
+export USB_DEV
+${CWD}/getdiskinfo
+cp -f ${CWD}/write_disk_info_to_usb .
+sync