Last change
on this file since 3320 was 3320, checked in by Bruno Cornec, 9 years ago |
- Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in
the move to 3.0
|
-
Property svn:executable
set to
*
|
File size:
1.5 KB
|
Rev | Line | |
---|
[3320] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | if [ "$#" -ne "1" ] && [ "$#" -ne "2" ] ; then
|
---|
| 5 | echo "make-me-bootable <fname> (dummy)"
|
---|
| 6 | exit 1
|
---|
| 7 | fi
|
---|
| 8 |
|
---|
| 9 | dummy=$2
|
---|
| 10 | boot_drv=""
|
---|
| 11 | boot_part=""
|
---|
| 12 | root_drv=""
|
---|
| 13 | root_part=""
|
---|
| 14 |
|
---|
| 15 | HAVE_ACTIVE="false"
|
---|
| 16 | 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 | # Warning wrong if LVM !
|
---|
| 20 | 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/'`
|
---|
| 22 |
|
---|
| 23 | if [ "$HAVE_ACTIVE" = "false" ] && [ "`parted2fdisk -l $drive | tr -s '\t' ' ' | grep "$i " | grep -v "*"`" ] ; then
|
---|
| 24 | if [ "$mountpt" = "/" ] ; then
|
---|
| 25 | root_drv=$drive
|
---|
| 26 | root_part=$partno
|
---|
| 27 | elif [ "$mountpt" = "/boot" ] ; then
|
---|
| 28 | boot_drv=$drive
|
---|
| 29 | boot_part=$partno
|
---|
| 30 | fi
|
---|
| 31 | fi
|
---|
| 32 | done
|
---|
| 33 |
|
---|
| 34 | if [ "$boot_drv" ] ; then
|
---|
| 35 | drive=$boot_drv
|
---|
| 36 | partno=$boot_part
|
---|
| 37 | elif [ "$root_drv" ] ; then
|
---|
| 38 | drive=$root_drv
|
---|
| 39 | partno=$root_part
|
---|
| 40 | else
|
---|
| 41 | driveline=`grep -E '[ ]/boot[ ]' $1`
|
---|
| 42 | [ ! "$driveline" ] && driveline=`grep -E '[ ]/[ ]' $1`
|
---|
| 43 | partno=`echo "$driveline" | cut -d' ' -f1 | awk -F "[a-z]" '{print $NF;}'`
|
---|
| 44 | # echo "driveline=$driveline --> partno=$partno"
|
---|
| 45 | fi
|
---|
| 46 |
|
---|
| 47 | if [ "$drive" ] ; then
|
---|
| 48 | 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
|
---|
| 56 | fi
|
---|
| 57 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.