]> git.sur5r.net Git - bacula/rescue/blob - rescue/linux/usb/write_disk_info_to_usb
b5374b3cb00d4773f1117569ab86e71168a4f762
[bacula/rescue] / rescue / linux / usb / write_disk_info_to_usb
1 #!/bin/sh
2 #
3 # write the disk info from the current system to the USB
4 #  stick.  We write it in the home-rw partition
5 #
6 . ./config
7
8 if [ ! `whoami` = "root" ] ; then
9   echo ""
10   echo "You need to be root to run this shell script"
11   echo ""
12   exit 1
13 fi
14
15 echo " "
16 echo "This script will write your current system information to the USB"
17 echo "stick in the home-rw partition (/home/ubuntu)"
18
19 if [ ! -d ${MOUNT_POINT}/home-rw ] ; then
20    mount ${USB_DEV}3 ${MOUNT_POINT}/home-rw
21 fi
22 if [ ! -d ${MOUNT_POINT}/home-rw ] ; then
23   echo "Mount of home-rw USB partition failed."
24   echo "Please pre-mount the USB stick and run this script again."
25   exit 1
26 fi
27 cd ${MOUNT_POINT}/home-rw
28 if [ $? -ne 0 ] ; then
29   echo "Could not cd to home-rw USB partition"
30   exit 1
31 fi
32
33 mkdir -p ubuntu
34 chown 1000:1000 ubuntu
35 cd ubuntu
36 export USB_DEV
37 ${CWD}/getdiskinfo
38 cp -f ${CWD}/write_disk_info_to_usb .
39 sync