Last change
on this file since 3276 was 911, checked in by Bruno Cornec, 18 years ago |
Further removal of all instances of grep -wx in code.
|
-
Property svn:keywords
set to
Id
-
Property svn:unix-mode
set to
755
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 |
|
---|
3 |
|
---|
4 | LOGFILE=/tmp/mondo-restore.log
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 | if [ "$#" -ne "1" ] && [ "$#" -ne "2" ] ; then
|
---|
9 | echo "make-me-bootable <fname> (dummy)"
|
---|
10 | exit 1
|
---|
11 | fi
|
---|
12 |
|
---|
13 | dummy=$2
|
---|
14 | boot_drv=""
|
---|
15 | boot_part=""
|
---|
16 | root_drv=""
|
---|
17 | root_part=""
|
---|
18 |
|
---|
19 | HAVE_ACTIVE="false"
|
---|
20 | for i in `cat $1 | tr -s '\t' ' ' | cut -d' ' -f1 | grep -vE "/dev/fd|none|#"` ; do
|
---|
21 | mountpt=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f2`
|
---|
22 | format=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f3`
|
---|
23 | drive=`echo $i | sed -e 's/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'`
|
---|
24 | partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'`
|
---|
25 |
|
---|
26 | if [ "$HAVE_ACTIVE" = "false" ] && [ "`parted2fdisk -l $drive | tr -s '\t' ' ' | grep "$i " | grep -v "*"`" ] ; then
|
---|
27 | if [ "$mountpt" = "/" ] ; then
|
---|
28 | root_drv=$drive
|
---|
29 | root_part=$partno
|
---|
30 | elif [ "$mountpt" = "/boot" ] ; then
|
---|
31 | boot_drv=$drive
|
---|
32 | boot_part=$partno
|
---|
33 | fi
|
---|
34 | fi
|
---|
35 | done
|
---|
36 |
|
---|
37 | if [ "$boot_drv" ] ; then
|
---|
38 | drive=$boot_drv
|
---|
39 | partno=$boot_part
|
---|
40 | elif [ "$root_drv" ] ; then
|
---|
41 | drive=$root_drv
|
---|
42 | partno=$root_part
|
---|
43 | else
|
---|
44 | driveline=`grep -E '[ ]/boot[ ]' $1`
|
---|
45 | [ ! "$driveline" ] && driveline=`grep -E '[ ]/[ ]' $1`
|
---|
46 | partno=`echo "$driveline" | cut -d' ' -f1 | awk -F "[a-z]" '{print $NF;}'`
|
---|
47 | # echo "driveline=$driveline --> partno=$partno"
|
---|
48 | fi
|
---|
49 |
|
---|
50 | if [ "$drive" ] ; then
|
---|
51 | if [ "$dummy" != "" ] ; then
|
---|
52 | if [ "$partno" = "0" ] || [ ! "$partno" ] ; then
|
---|
53 | partno="1"
|
---|
54 | fi
|
---|
55 | echo "$partno"
|
---|
56 | else
|
---|
57 | echo -en "a\n$partno\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE
|
---|
58 | fi
|
---|
59 | fi
|
---|
60 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.