Changeset 3057 in MondoRescue for branches/3.0/mondo/src/restore-scripts
- Timestamp:
- Nov 2, 2012, 8:28:12 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.