source: branches/2.2.2/mondo/src/restore-scripts/mondo/make-me-bootable @ 1315

Last change on this file since 1315 was 1315, checked in by bruno, 12 years ago

Log files are now consistent: mondoarchive.log for mondoarchive (containing also mindi.log) and mondorestore.log for mondorestore (copied from /tmp (ram) to /var/log (disk) at the end of the restore)
One include has been created for each bianry containing only that declaration ofr the moment, but which will be extended to include all local definitions (ps_* e.g.)
Doc updated accordingly
LOGFILE in restore process is now passed in the environment and not duplicated anymore
LogIt? is not redifined either
LOGFILE should be put in environment by mondoarchive for mindi's usage but that's a step left for later.

  • Property svn:keywords set to Id
  • Property svn:unix-mode set to 755
File size: 1.5 KB
Line 
1#!/bin/sh
2
3
4if [ "$#" -ne "1" ] && [ "$#" -ne "2" ] ; then
5    echo "make-me-bootable <fname> (dummy)"
6    exit 1
7fi
8
9dummy=$2
10boot_drv=""
11boot_part=""
12root_drv=""
13root_part=""
14
15HAVE_ACTIVE="false"
16for 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    drive=`echo $i | sed -e 's/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'`
20    partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'`
21
22    if [ "$HAVE_ACTIVE" = "false" ] && [ "`parted2fdisk -l $drive | tr -s '\t' ' ' | grep "$i " | grep -v "*"`" ] ; then
23        if [ "$mountpt" = "/" ] ; then
24            root_drv=$drive
25        root_part=$partno
26        elif [ "$mountpt" = "/boot" ] ; then
27            boot_drv=$drive
28            boot_part=$partno
29        fi
30    fi
31done
32
33if [ "$boot_drv" ] ; then
34    drive=$boot_drv
35    partno=$boot_part
36elif [ "$root_drv" ] ; then
37    drive=$root_drv
38    partno=$root_part
39else
40    driveline=`grep -E '[   ]/boot[     ]' $1`
41    [ ! "$driveline" ] && driveline=`grep -E '[     ]/[     ]' $1`
42    partno=`echo "$driveline" | cut -d' ' -f1 | awk -F "[a-z]" '{print $NF;}'`
43#    echo "driveline=$driveline --> partno=$partno"
44fi
45
46if [ "$drive" ] ; then
47    if [ "$dummy" != "" ] ; then
48        if [ "$partno" = "0" ] || [ ! "$partno" ] ; then
49        partno="1"
50    fi
51        echo "$partno"
52    else
53        echo -en "a\n$partno\nw\n" | parted2fdisk $drive >> $LOGFILE 2>> $LOGFILE
54    fi
55fi
56exit 0
Note: See TracBrowser for help on using the repository browser.