Changeset 1449 in MondoRescue
- Timestamp:
- May 18, 2007, 2:53:05 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/restore-scripts/mondo/stabgrub-me
r1341 r1449 8 8 QuitIfNotFound() { 9 9 if [ ! -f "$1" ] ; then 10 LogIt "(stabgrub-me) Where's $1? I cannot continue." 111 exit 110 LogIt "(stabgrub-me) Where's $1? I cannot continue." 1 11 exit 1 12 12 fi 13 13 } … … 29 29 # we run this outside the chroot. 30 30 if [ -L "$old_grubconf" ] ; then 31 old_grubconf=/mnt/RESTORING/etc/`readlink "$old_grubconf"` 31 l=`readlink "$old_grubconf"` 32 if [ _"`echo $l | cut -c1`" = _"/" ]; then 33 # If readlink gives an absolute path it's related to the chroot 34 old_grubconf=/mnt/RESTORING/$l 35 else 36 # If readlink gives a relative path, it's in the same dir 37 old_grubconf=/mnt/RESTORING/etc/$l 38 fi 32 39 fi 33 40 return 0 … … 41 48 where_they_live="" 42 49 for curr_fstab in $fstab_list ; do 43 curr_dir=`echo $curr_fstab | gawk '{i=index($0,"/fstab");print substr($0,0,i-1);}'`44 resA=$?45 curr_inetd=`find $curr_dir -name inetd.conf | grep -v "linuxconf"`46 resB=$?47 if [ "$resA" -eq "0" ] ; then48 if [ "$where_they_live" != "" ] ; then49 LogIt "Two directories found! One is $where_they_live, the other $curr_dir" 150 LogIt "I don't know which to choose. I'll abort the search." 151 return 152 fi53 where_they_live=$curr_dir54 fi50 curr_dir=`echo $curr_fstab | gawk '{i=index($0,"/fstab");print substr($0,0,i-1);}'` 51 resA=$? 52 curr_inetd=`find $curr_dir -name inetd.conf | grep -v "linuxconf"` 53 resB=$? 54 if [ "$resA" -eq "0" ] ; then 55 if [ "$where_they_live" != "" ] ; then 56 LogIt "Two directories found! One is $where_they_live, the other $curr_dir" 1 57 LogIt "I don't know which to choose. I'll abort the search." 1 58 return 1 59 fi 60 where_they_live=$curr_dir 61 fi 55 62 done 56 63 if [ "$where_they_live" = "" ] ; then 57 LogIt "Cannot find any folder which holds fstab _and_ inetd.conf" 158 return 164 LogIt "Cannot find any folder which holds fstab _and_ inetd.conf" 1 65 return 1 59 66 fi 60 67 old_grubconf=$where_they_live/grub.conf … … 71 78 LogIt "Backing up original files before modifying them..." 2 72 79 for i in $old_grubconf $old_fstab ; do 73 LogIt "Backing up $i"80 LogIt "Backing up $i" 74 81 [ -e "$i" ] && [ ! -e "$i.$BEFORE" ] && cp -f $i $i.$BEFORE 75 82 done … … 82 89 cp -f $old_fstab /tmp/fstab.ugly 83 90 for i in $old_grubconf $old_fstab ; do 84 LogIt "Restoring $i"85 [ -f "$i.$BEFORE" ] && cp -f $i.$BEFORE $i91 LogIt "Restoring $i" 92 [ -f "$i.$BEFORE" ] && cp -f $i.$BEFORE $i 86 93 done 87 94 } … … 145 152 fi 146 153 if [ "$outval" -ne "0" ] ; then 147 LogIt "Modifications (copying) failed. Restoring from backups." 3148 RestoreBackups154 LogIt "Modifications (copying) failed. Restoring from backups." 3 155 RestoreBackups 149 156 else 150 LogIt "Fstab modified ok." 2157 LogIt "Fstab modified ok." 2 151 158 fi 152 159 cd /mnt/RESTORING … … 159 166 if [ "$grub_res" -ne "0" ] ; then 160 167 LogIt "grub-install failed. Running grub-MR..." 161 chroot /mnt/RESTORING grub-install '(hd0)' >> $LOGFILE 2>> $LOGFILE168 chroot /mnt/RESTORING grub-install '(hd0)' >> $LOGFILE 2>> $LOGFILE 162 169 grub_res=$? 163 170 fi
Note:
See TracChangeset
for help on using the changeset viewer.