3 # This script makes a copy of an existing boot cd or iso on
4 # disk so that we can add the Bacula code to it for remastering
6 # When we are done if there is no error, we should have the
7 # cdrom image in cdimage
15 Usage: make_rescue_disk
16 -h, --help print this message
17 --type=cdrom|iso start with a cdrom or iso image
18 --where=path the path to the device (mounted) or the iso
22 if [ ! `whoami` = "root" ] ; then
24 echo "You need to be root to run this, otherwise"
25 echo "I cannot mount the loopback. Continuing anyway ..."
31 # Process command line options
33 for option in "$@" ; do
46 where=`echo "$option"|cut -c 9-`
49 echo "Unknown option specified: $option"
56 if [ x$type == x ] ; then
58 echo "You can make the rescue disk either from a mounted CDROM or"
59 echo "from a .iso image. Please enter cdrom or iso:"
61 if [ $type == 'cdrom' ] ; then
62 echo "OK want mounted CDROM"
63 elif [ $type == 'iso' ] ; then
64 echo "OK want iso image"
70 if [ x$where == x ] ; then
72 echo "Enter location of image e.g. /mnt/cdrom or /home/src/.../rescue.iso"
75 if [ ! -e $where ]; then
76 echo "Cannot find rescue image $where"
79 if [ $type == iso ]; then
82 mount -o loop $where mnt
92 echo "Copy from iso to cdimage failed"
100 if [ $type == cdrom ] ; then
103 cp -a $where/* cdimage
104 if [ $? != 0 ] ; then
105 echo "Copy from cdrom to cdimage failed"