Changeset 3057 in MondoRescue
- Timestamp:
- Nov 2, 2012, 8:28:12 PM (12 years ago)
- Location:
- branches/3.0/mondo/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/mondorestore/mondo-prep.c
r3048 r3057 1691 1691 1692 1692 if (pout_to_fdisk) { 1693 // mark relevant partition as bootable 1694 sprintf(tmp, "a\n%s\n", 1695 call_program_and_get_last_line_of_output 1696 ("make-me-bootable /tmp/mountlist.txt dummy")); 1697 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 1698 // close fdisk 1693 // close fdisk 1699 1694 fput_string_one_char_at_a_time(pout_to_fdisk, "p\n"); 1700 1695 fput_string_one_char_at_a_time(pout_to_fdisk, "w\n"); 1696 paranoid_pclose(pout_to_fdisk); 1701 1697 system("sync"); 1702 paranoid_pclose(pout_to_fdisk); 1703 log_msg(0, 1704 "------------------- fdisk.log looks like this ------------------"); 1698 log_msg(0,"------------------- fdisk.log looks like this ------------------"); 1705 1699 sprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE); 1706 1700 system(tmp); 1707 log_msg(0, 1708 "------------------- end of fdisk.log... ------------------"); 1701 // mark relevant partition as bootable 1702 mr_asprintf(&tmp1,"make-me-bootable /tmp/mountlist.txt %s noaction",drivename); 1703 call_program_and_get_last_line_of_output(tmp1); 1704 mr_free(tmp1); 1705 log_msg(0,"------------------- end of fdisk.log... ------------------"); 1706 system("sync"); 1709 1707 sprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG); 1710 1708 if (!run_program_and_log_output(tmp, 5)) { -
branches/3.0/mondo/src/restore-scripts/mondo/make-me-bootable
r2196 r3057 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 "Will activate $p 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
Note:
See TracChangeset
for help on using the changeset viewer.