From: Kern Sibbald Date: Sat, 3 Jan 2009 15:39:27 +0000 (+0000) Subject: Update X-Git-Tag: Release-5.0.3~837 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5fa1e7c63be2c5b2ec292956ea52fde0521fa242;p=bacula%2Frescue Update --- diff --git a/rescue/linux/usb/getdiskinfo b/rescue/linux/usb/getdiskinfo index 4e90cd1..75ec655 100755 --- a/rescue/linux/usb/getdiskinfo +++ b/rescue/linux/usb/getdiskinfo @@ -7,9 +7,10 @@ # This source distributed under the GPL # export LANG=C -di=diskinfo cwd=`pwd` host=`uname -s` +di=${cwd}/diskinfo +scr=${cwd}/scripts case $host in Linux) @@ -35,7 +36,7 @@ fi # # First collect information # -rm -rf format.* partition.* $di create-* +rm -rf format.* partition.* $di create-* $scr echo "Begin collecting system info ..." mkdir -p $di cd $di @@ -80,9 +81,10 @@ echo "Begin creating scripts ..." # # First create partitioning script(s) # +mkdir -p $scr for i in `cat disks.bsi`; do j=`echo $i | cut -c6-` - cat >$cwd/partition.$j <$scr/partition.$j < $cwd/create-pv < $scr/create-pv <> $cwd/create-pv + echo "echo \" $pv\"" >> $scr/create-pv done - cat >> $cwd/create-pv <> $scr/create-pv <> $cwd/create-pv - echo "lvm pvcreate -ff -y -v $pv" >> $cwd/create-pv + echo "echo \"Creating PV on $pv\"" >> $scr/create-pv + echo "lvm pvcreate -ff -y -v $pv" >> $scr/create-pv done - echo "echo \"Done.\"" >> $cwd/create-pv - echo "echo \"If there were no errors, run create-vg to create the volume groups.\"" >> $cwd/create-pv - chmod +x $cwd/create-pv + echo "echo \"Done.\"" >> $scr/create-pv + echo "echo \"If there were no errors, run create-vg to create the volume groups.\"" >> $scr/create-pv + chmod +x $scr/create-pv # # LVM phase 2: create Volume Groups # - cat > $cwd/create-vg < $scr/create-vg <> $cwd/create-vg - pelist="" - for pv in `cat lvm-pv.bsi | awk "\\\$2 == \"$vg\" { print \\\$1 }"` ; do - pelist="$pelist $pv" - done - echo "lvm vgcreate $vg -v -s ${pesize}k $pelist" >> $cwd/create-vg + echo "echo \"Creating VG $vg PE extent size $pesize kbytes"\" >> $scr/create-vg + pelist="" + for pv in `cat lvm-pv.bsi | awk "\\\$2 == \"$vg\" { print \\\$1 }"` ; do + pelist="$pelist $pv" + done + echo "lvm vgcreate $vg -v -s ${pesize}k $pelist" >> $scr/create-vg done - echo "echo \"Done.\"" >> $cwd/create-vg - echo "echo \"If there were no errors, run create-lv to create the logical volumes.\"" >> $cwd/create-vg - chmod +x $cwd/create-vg + echo "echo \"Done.\"" >> $scr/create-vg + echo "echo \"If there were no errors, run create-lv to create the logical volumes.\"" >> $scr/create-vg + chmod +x $scr/create-vg # @@ -192,7 +194,7 @@ EOF # Using the extent count should allow this script to continue to work # even after the bug is fixed. - cat > $cwd/create-lv < $scr/create-lv <> $cwd/create-lv - echo "lvm lvcreate -L ${lvsize}k $vg -n $lv" >> $cwd/create-lv + # lv=`echo $lv | sed -e 's/.*\///'` + echo "echo \"Creating LV $lv\"" >> $scr/create-lv + echo "lvm lvcreate -L ${lvsize}k $vg -n $lv" >> $scr/create-lv done - chmod +x $cwd/create-lv + chmod +x $scr/create-lv fi # @@ -218,7 +220,7 @@ fi echo "Begin making formatting script(s) ..." for i in `cat disks.bsi`; do j=`echo $i | cut -c6-` - cat >$cwd/format.$j <$scr/format.$j <>$cwd/format.$j - echo "mkswap $check $disk" >>$cwd/format.$j - echo "echo \"\"" >>$cwd/format.$j + echo "echo \"Formatting $disk -- swap partition\"" >>$scr/format.$j + echo "mkswap $check $disk" >>$scr/format.$j + echo "echo \"\"" >>$scr/format.$j done # Find ext2 partitions in mount output k=`grep "^$i" mount.ext2.bsi | cut -d ' ' -f 1` for disk in $k; do - echo "echo \"Formating $disk -- ext2 partition\"" >>$cwd/format.$j + echo "echo \"Formating $disk -- ext2 partition\"" >>$scr/format.$j label=`grep "^$disk" mount.ext2.bsi | cut -d ' ' -f 7 | cut -c2- | cut -d ] -f 1` if [ x$label = x ] ; then - echo "mke2fs -v \$check $disk" >>$cwd/format.$j + echo "mke2fs -v \$check $disk" >>$scr/format.$j else - echo "mke2fs -v \$check -L $label $disk" >>$cwd/format.$j + echo "mke2fs -v \$check -L $label $disk" >>$scr/format.$j fi - echo "echo \"\"" >>$cwd/format.$j + echo "echo \"\"" >>$scr/format.$j done # Find ext3 partitions in mount output k=`grep "^$i" mount.ext3.bsi | cut -d ' ' -f 1` for disk in $k; do - echo "echo \"Formating $disk -- ext3 partition\"" >>$cwd/format.$j + echo "echo \"Formating $disk -- ext3 partition\"" >>$scr/format.$j label=`grep "^$disk" mount.ext3.bsi | cut -d ' ' -f 7 | cut -c2- | cut -d ] -f 1` if [ x$label = x ] ; then - echo "mke2fs -v -j \$check $disk" >>$cwd/format.$j + echo "mke2fs -v -j \$check $disk" >>$scr/format.$j else - echo "mke2fs -v -j \$check -L $label $disk" >>$cwd/format.$j + echo "mke2fs -v -j \$check -L $label $disk" >>$scr/format.$j fi - echo "echo \"\"" >>$cwd/format.$j + echo "echo \"\"" >>$scr/format.$j done # Find reiserfs partitions in mount output k=`grep "^$i" mount.rei.bsi | cut -d ' ' -f 1` for disk in $k; do - echo "echo \"Formating $disk -- reiser partition\"" >>$cwd/format.$j + echo "echo \"Formating $disk -- reiser partition\"" >>$scr/format.$j label=`grep "^$disk" mount.rei.bsi | cut -d ' ' -f 7 | cut -c2- | cut -d ] -f 1` if [ x$label = x ] ; then - echo "mkereiserfs -V \$check $disk" >>$cwd/format.$j + echo "mkereiserfs -V \$check $disk" >>$scr/format.$j else - echo "mkereiserfs -V \$check -L $label $disk" >>$cwd/format.$j + echo "mkereiserfs -V \$check -L $label $disk" >>$scr/format.$j fi - echo "echo \"\"" >>$cwd/format.$j + echo "echo \"\"" >>$scr/format.$j done - chmod 755 $cwd/format.$j + chmod 755 $scr/format.$j done # @@ -298,7 +300,7 @@ done if [ $dolvm -eq 1 ] ; then echo "Begin making LVM formatting script(s) ..." for i in `cat lvm-vg.bsi | awk '{print $1}'`; do - cat >$cwd/format.$i <$scr/format.$i <>$cwd/format.$i - echo "mkswap $check $disk" >>$cwd/format.$i - echo "echo \"\"" >>$cwd/format.$i + echo "echo \"Formatting $disk -- swap partition\"" >>$scr/format.$i + echo "mkswap $check $disk" >>$scr/format.$i + echo "echo \"\"" >>$scr/format.$i done # Find ext2 partitions in mount output k=`grep "^$mapper" mount.ext2.bsi | cut -d ' ' -f 1` for disk in $k; do - echo "echo \"Formating $disk -- ext2 partition\"" >>$cwd/format.$i + echo "echo \"Formating $disk -- ext2 partition\"" >>$scr/format.$i label=`grep "^$disk on" mount.ext2.bsi | cut -d ' ' -f 7 | cut -c2- | cut -d ] -f 1` if [ x$label = x ] ; then - echo "mke2fs -v \$check $disk" >>$cwd/format.$i + echo "mke2fs -v \$check $disk" >>$scr/format.$i else - echo "mke2fs -v \$check -L $label $disk" >>$cwd/format.$i + echo "mke2fs -v \$check -L $label $disk" >>$scr/format.$i fi - echo "echo \"\"" >>$cwd/format.$i + echo "echo \"\"" >>$scr/format.$i done # Find ext3 partitions in mount output k=`grep "^$mapper" mount.ext3.bsi | cut -d ' ' -f 1` for disk in $k; do - echo "echo \"Formating $disk -- ext3 partition\"" >>$cwd/format.$i + echo "echo \"Formating $disk -- ext3 partition\"" >>$scr/format.$i label=`grep "^$disk on" mount.ext3.bsi | cut -d ' ' -f 7 | cut -c2- | cut -d ] -f 1` if [ x$label = x ] ; then - echo "mke2fs -v -j \$check $disk" >>$cwd/format.$i + echo "mke2fs -v -j \$check $disk" >>$scr/format.$i else - echo "mke2fs -v -j \$check -L $label $disk" >>$cwd/format.$i + echo "mke2fs -v -j \$check -L $label $disk" >>$scr/format.$i fi - echo "echo \"\"" >>$cwd/format.$i + echo "echo \"\"" >>$scr/format.$i done # Find reiserfs partitions in mount output k=`grep "^$mapper" mount.rei.bsi | cut -d ' ' -f 1` for disk in $k; do - echo "echo \"Formating $disk -- reiser partition\"" >>$cwd/format.$i + echo "echo \"Formating $disk -- reiser partition\"" >>$scr/format.$i label=`grep "^$disk on" mount.rei.bsi | cut -d ' ' -f 7 | cut -c2- | cut -d ] -f 1` if [ x$label = x ] ; then - echo "mkereiserfs -V \$check $disk" >>$cwd/format.$i + echo "mkereiserfs -V \$check $disk" >>$scr/format.$i else - echo "mkereiserfs -V \$check -L $label $disk" >>$cwd/format.$i + echo "mkereiserfs -V \$check -L $label $disk" >>$scr/format.$i fi - echo "echo \"\"" >>$cwd/format.$i + echo "echo \"\"" >>$scr/format.$i done - chmod 755 $cwd/format.$i + chmod 755 $scr/format.$i done fi -cd $cwd +cd $scr # # Create network start script @@ -411,7 +413,7 @@ END_OF_DATA chmod 755 start_network -cat >mount_drives <$scr/mount_drives <>$ sort -k 2 <${TMP1} >${TMP2} # output mkdir followed by its mount sed -n 's/\(^.*\)\ \(.*$\)/mkdir -p \2\ -mount \1 \2/p' ${TMP2} >>mount_drives +mount \1 \2/p' ${TMP2} >>$scr/mount_drives # Now build unmount_drives -cat >umount_drives <$scr/umount_drives <${TMP2} -sed -n 's/\(^.*\)\ \(.*$\)/umount \2/p' ${TMP2} >>umount_drives -echo "umount /mnt/cdrom 2>/dev/null >/dev/null" >>umount_drives -echo "sync" >>umount_drives -echo "sync" >>umount_drives +sed -n 's/\(^.*\)\ \(.*$\)/umount \2/p' ${TMP2} >>$scr/umount_drives +echo "umount /mnt/cdrom 2>/dev/null >/dev/null" >>$scr/umount_drives +echo "sync" >>$scr/umount_drives +echo "sync" >>$scr/umount_drives rm -f ${TMP1} ${TMP2} -chmod 755 mount_drives umount_drives +chmod 755 $scr/mount_drives $scr/umount_drives echo "Done building scripts." diff --git a/rescue/linux/usb/load_disk_image b/rescue/linux/usb/load_disk_image deleted file mode 100755 index e25019d..0000000 --- a/rescue/linux/usb/load_disk_image +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# tar the disk image -# -. ./config - -if [ ! `whoami` = "root" ] ; then - echo "" - echo "You need to be root to run this shell script" - echo "" - exit 1 -fi - -umount ${USB_DEV}1 -mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1 -mount ${MOUNT_POINT}/kubuntu8 -if [ $? -ne 0 ] ; then - echo "Mount of USB boot partition failed." - exit 1 -fi -cd ${MOUNT_POINT}/kubuntu8 -if [ $? -ne 0 ] ; then - echo "Could not cd to USB boot partition" - exit 1 -fi -tar xfz ${BOOT_IMAGE} . -ls -l ${MOUNT_POINT}/kubuntu8 -sync -unmount ${MOUNT_POINT}/kubuntu8 diff --git a/rescue/linux/usb/loadsqfs b/rescue/linux/usb/loadsqfs deleted file mode 100755 index 9eea9e6..0000000 --- a/rescue/linux/usb/loadsqfs +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Load squashfs onto the USB key -# - -key=/media/kubuntu8 - -if [ ! -d $key/casper ] ; then - echo "Cannot find $key/casper directory -- possibly not mounted" - exit 1 -fi - -echo "Removing old squashfs" -rm -f $key/casper/filesystem.squashfs $key/casper/filesystem.manifest -rm -f $key/casper/filesystem.manifest-desktop - -echo "Copying new squashfs" -cp filesystem.manifest $key/casper/ -cp filesystem.manifest $key/casper/filesystem.manifest-desktop -cp filesystem.squashfs $key/casper/ -sync diff --git a/rescue/linux/usb/new_sqfs b/rescue/linux/usb/new_sqfs new file mode 100755 index 0000000..8cf2836 --- /dev/null +++ b/rescue/linux/usb/new_sqfs @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Put a new squashfs on the disk image +# + +. ./config + + +if [ ! -d ${DISK_IMAGE}/casper ] ; then + echo "Cannot find ${DISK_IMAGE}/casper directory -- possibly not detarred" + exit 1 +fi + +echo "Removing old squashfs" +rm -f ${DISK_IMAGE}/casper/filesystem.squashfs ${DISK_IMAGE}/casper/filesystem.manifest +rm -f ${DISK_IMAGE}/casper/filesystem.manifest-desktop + +echo "Copying new squashfs" +cp filesystem.manifest ${DISK_IMAGE}/casper/ +cp filesystem.manifest ${DISK_IMAGE}/casper/filesystem.manifest-desktop +cp filesystem.squashfs ${DISK_IMAGE}/casper/ +sync diff --git a/rescue/linux/usb/pack_sqfs b/rescue/linux/usb/pack_sqfs new file mode 100755 index 0000000..927792b --- /dev/null +++ b/rescue/linux/usb/pack_sqfs @@ -0,0 +1,4 @@ +#!/bin/sh +# +rm -f filesystem.squashfs +mksquashfs sqfs filesystem.squashfs diff --git a/rescue/linux/usb/packsqfs b/rescue/linux/usb/packsqfs deleted file mode 100755 index 927792b..0000000 --- a/rescue/linux/usb/packsqfs +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# -rm -f filesystem.squashfs -mksquashfs sqfs filesystem.squashfs diff --git a/rescue/linux/usb/partition_usb_key b/rescue/linux/usb/partition_usb_key new file mode 100755 index 0000000..825400a --- /dev/null +++ b/rescue/linux/usb/partition_usb_key @@ -0,0 +1,73 @@ +#!/bin/sh +# +# Partition the USB stick -- the stick is assumed to be at least 3GB in size +# +# First delete all existing partitions +# +. ./config + +if [ ! `whoami` = "root" ] ; then + echo "" + echo "You need to be root to run this shell script" + echo "" + exit 1 +fi +if [ "x$USB_DEV" = "x" ] ; then + if [ "x$1" = "x" ] ; then + echo "You must supply the USB device name on the command line or in USB_DEV" + exit 1 + else + USB_DEV=$1 + fi +fi +echo "This script will distroy everything on $dev" +fdisk -l $USB_DEV +echo " " +echo "Answer yes to continue " +read a +if [ "$a" != "yes" ] ; then + echo "Device $USB_DEV unchanged" + exit 1 +fi + +fdisk $USB_DEV </dev/null 1>/dev/null +echo "Reformat USB boot partition" +mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1 +mount ${USB_DEV}1 ${MOUNT_POINT}/kubuntu8 +if [ $? -ne 0 ] ; then + echo "Mount of USB boot partition failed." + exit 1 +fi +cd ${MOUNT_POINT}/kubuntu8 +if [ $? -ne 0 ] ; then + echo "Could not cd to USB boot partition" + exit 1 +fi +echo "Detaring boot image ..." +tar xfz ${BOOT_IMAGE} +cd ${CWD} +ls -l ${MOUNT_POINT}/kubuntu8 +echo "syncing ..." +sync +umount ${MOUNT_POINT}/kubuntu8