Changeset 3147 in MondoRescue for branches/3.1/mondo/src/restore-scripts
- Timestamp:
- Jun 19, 2013, 8:34:46 AM (12 years ago)
- Location:
- branches/3.1/mondo/src/restore-scripts/mondo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/restore-scripts/mondo/grub-MR
r2937 r3147 107 107 if [ "$MNT_RESTORING" ] ; then 108 108 if [ -x $MNT_RESTORING/usr/sbin/grub-install.unsupported ]; then 109 echo "Now I'll use grub-install.unsupportedin chroot" >> $LOGFILE110 chroot $MNT_RESTORING /usr/sbin/grub-install .unsupported $1>> $LOGFILE 2>> $LOGFILE109 echo "Now I'll use OpenSuSE/SLES new grub-install in chroot" >> $LOGFILE 110 chroot $MNT_RESTORING /usr/sbin/grub-install >> $LOGFILE 2>> $LOGFILE 111 111 res=$? 112 echo "grub-install .unsupportedin chroot returned $res" >> $LOGFILE112 echo "grub-install in chroot returned $res" >> $LOGFILE 113 113 fi 114 114 else 115 115 if [ -x /usr/sbin/grub-install.unsupported ]; then 116 echo "Now I'll use grub-install.unsupportedlocally" >> $LOGFILE117 /usr/sbin/grub-install .unsupported $1>> $LOGFILE 2>> $LOGFILE116 echo "Now I'll use OpenSuSE/SLES new grub-install locally" >> $LOGFILE 117 /usr/sbin/grub-install >> $LOGFILE 2>> $LOGFILE 118 118 res=$? 119 echo "grub-install .unsupportedreturned $res" >> $LOGFILE119 echo "grub-install returned $res" >> $LOGFILE 120 120 fi 121 121 fi … … 124 124 echo "Now I'll use grub-install" >> $LOGFILE 125 125 if [ "$MNT_RESTORING" ] ; then 126 echo "Launching: chroot $MNT_RESTORING grub-install $1" >> $LOGFILE 126 127 chroot $MNT_RESTORING grub-install $1 >> $LOGFILE 2>> $LOGFILE 127 128 res=$? 128 129 else 130 echo "Launching: grub-install $1" >> $LOGFILE 129 131 grub-install $1 >> $LOGFILE 2>> $LOGFILE 130 132 res=$? 131 133 fi 132 134 echo "grub-install returned $res" >> $LOGFILE 135 [ "$res" -eq "0" ] && exit 0 136 137 138 echo "Now I'll use grub2-install" >> $LOGFILE 139 if [ "$MNT_RESTORING" ] ; then 140 chroot $MNT_RESTORING grub2-install $1 >> $LOGFILE 2>> $LOGFILE 141 res=$? 142 else 143 grub2-install $1 >> $LOGFILE 2>> $LOGFILE 144 res=$? 145 fi 146 echo "grub2-install returned $res" >> $LOGFILE 133 147 [ "$res" -eq "0" ] && exit 0 134 148 … … 190 204 elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then 191 205 grep -vE '^#' /boot/grub/grub.cfg > /mnt/RESTORING/tmp/grub.conf 206 elif [ -f "/mnt/RESTORING/boot/grub2/grub.cfg" ]; then 207 grep -vE '^#' /boot/grub2/grub.cfg > /mnt/RESTORING/tmp/grub.conf 192 208 else 193 209 echo "Unable to find Grub conf file" | tee -a $LOGFILE -
branches/3.1/mondo/src/restore-scripts/mondo/label-partitions-as-necessary
r2462 r3147 28 28 else 29 29 if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] || [ "$format" = "ext4" ]; then 30 command="tune2fs $opttun $label $mountpt" 30 if [ "$format" = "ext4" ] && [ -x "/sbin/tune4fs" ]; then 31 command="/sbin/tune4fs $opttun $label $mountpt" 32 else 33 command="tune2fs $opttun $label $mountpt" 34 fi 31 35 LogIt "Running $command" 32 36 $command … … 38 42 if [ "$opttun" = "-U" ]; then 39 43 LogIt "Creating uuid $label on swap partition $mountpt" 40 echo -n "$label" | perl -ne 's/-//g;chomp;print pack "H*",$_' | dd conv=notrunc "of=$mountpt" obs=1 seek=1036 44 if [ -x "/sbin/swaplabel" ]; then 45 /sbin/swaplabel $opttun $label $mountpt 46 else 47 echo -n "$label" | perl -ne 's/-//g;chomp;print pack "H*",$_' | dd conv=notrunc "of=$mountpt" obs=1 seek=1036 48 fi 41 49 else 42 command="mkswap $opttun $label $mountpt" 50 if [ -x "/sbin/swaplabel" ]; then 51 command="/sbin/swaplabel $opttun $label $mountpt" 52 else 53 command="mkswap $opttun $label $mountpt" 54 fi 43 55 LogIt "Running $command" 44 56 $command 45 57 fi 46 58 else 47 LogIt "I am NOT going to run tune2 fs/reiserfstune: the partition is format '$format', which doesn't like tune2fs/reiserfstune anyway"59 LogIt "I am NOT going to run tune2|4fs/reiserfstune: the partition is format '$format', which doesn't like tune2|4fs/reiserfstune anyway" 48 60 fi 49 61 fi … … 53 65 # --------------------------------------------- 54 66 55 LogIt "Identifying your drives with tune2fs"67 LogIt "Identifying your drives with FS tune tool" 56 68 if [ "$#" -ne "1" ] ; then 57 69 LogIt "label-partitions-as-necessary $MINDI_CACHE/mountlist.txt < /tmp/fstab.new" 1 -
branches/3.1/mondo/src/restore-scripts/mondo/make-me-bootable
r2196 r3147 2 2 3 3 4 if [ "$#" -ne " 1" ] && [ "$#" -ne "2" ] ; then5 echo "make-me-bootable <fname> (dummy)"4 if [ "$#" -ne "2" ] && [ "$#" -ne "3" ] ; then 5 echo "make-me-bootable <fname> <drive> [noaction]" 6 6 exit 1 7 7 fi 8 8 9 d ummy=$29 drivetouse=$2 10 10 boot_drv="" 11 11 boot_part="" 12 12 root_drv="" 13 13 root_part="" 14 if [ ! "$LOGFILE" ]; then 15 LOGFILE="/tmp/mondorestore2.log" 16 fi 17 dummy="$3" 14 18 15 HAVE_ACTIVE="false" 19 activepart=`parted2fdisk -l $drivetouse | tr -s '\t' ' ' | grep "$drivetouse" | grep '*' | cut -d' ' -f1` 20 16 21 for i in `cat $1 | tr -s '\t' ' ' | cut -d' ' -f1 | grep -vE "/dev/fd|none|#"` ; do 17 mountpt=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f2`18 format=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f3`19 22 # Warning wrong if LVM ! 20 23 drive=`echo $i | sed -e 's/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'` 21 partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'` 24 if [ "$drivetouse" = "$drive" ]; then 25 # We can continue as this is the drive we ned to work on 26 partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'` 27 mountpt=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f2` 22 28 23 if [ "$HAVE_ACTIVE" = "false" ] && [ "`parted2fdisk -l $drive | tr -s '\t' ' ' | grep "$i " | grep -v "*"`" ] ; then24 29 if [ "$mountpt" = "/" ] ; then 25 30 root_drv=$drive 26 root_part=$partno31 root_part=$partno 27 32 elif [ "$mountpt" = "/boot" ] ; then 28 33 boot_drv=$drive … … 46 51 47 52 if [ "$drive" ] ; then 53 if [ "$partno" = "0" ] || [ ! "$partno" ] ; then 54 partno="1" 55 fi 56 cmd="" 57 for p in "$activepart"; do 58 # First desactivate active partitions (coming from previous usage) 59 cmd="${cmd}a\n$p\n" 60 if [ "$dummy" != "" ] ; then 61 echo "Will desactivate $p on $drive" >> $LOGFILE 62 fi 63 done 64 # Then activate the one which should 48 65 if [ "$dummy" != "" ] ; then 49 if [ "$partno" = "0" ] || [ ! "$partno" ] ; then 50 partno="1" 51 fi 52 echo "$partno" 53 else 54 echo -en "a\n$partno\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE 55 fi 66 echo "Would activate $partno on $drive" >> $LOGFILE 67 else 68 echo -en "${cmd}a\n$partno\np\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE 69 fi 56 70 fi 57 71 exit 0 -
branches/3.1/mondo/src/restore-scripts/mondo/stabgrub-me
r2508 r3147 57 57 LocateOldGrub() { 58 58 old_grubconf="" 59 if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ] || [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ] ; then59 if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ] || [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ] || [ -f "/mnt/RESTORING/boot/grub2/grub.cfg" ] ; then 60 60 LogIt "No need for menu.lst/grub.cfg search." 2 61 61 if [ -f "/mnt/RESTORING/boot/grub/menu.lst" ]; then … … 63 63 elif [ -f "/mnt/RESTORING/boot/grub/grub.cfg" ]; then 64 64 old_grubconf=/mnt/RESTORING/boot/grub/grub.cfg 65 elif [ -f "/mnt/RESTORING/boot/grub2/grub.cfg" ]; then 66 old_grubconf=/mnt/RESTORING/boot/grub2/grub.cfg 65 67 fi 66 68 if [ -L "$old_grubconf" ] ; then … … 68 70 if [ _"`echo $l | cut -c1`" = _"/" ]; then 69 71 # If readlink gives an absolute path it's related to the chroot 70 old_grubconf=/mnt/RESTORING/$l72 old_grubconf=/mnt/RESTORING/$l 71 73 else 72 74 # If readlink gives a relative path, it's in the same dir 73 old_grubconf=/mnt/RESTORING/boot/grub/$l 75 d=`dirname "$old_grubconf"` 76 old_grubconf=$d/$l 74 77 fi 75 fi 78 fi 76 79 return 0 77 80 fi … … 128 131 elif [ -f /mnt/RESTORING/boot/grub/grub.cfg ]; then 129 132 new_grubconf=/mnt/RESTORING/boot/grub/grub.cfg.NEW 133 elif [ -f /mnt/RESTORING/boot/grub2/grub.cfg ]; then 134 new_grubconf=/mnt/RESTORING/boot/grub2/grub.cfg.NEW 130 135 fi 131 136 # change back to /tmp if /mnt/RESTORING/etc be problematic
Note:
See TracChangeset
for help on using the changeset viewer.