source: MondoRescue/branches/3.0/mindi/rootfs/sbin/post-init @ 3319

Last change on this file since 3319 was 3319, checked in by Bruno Cornec, 7 years ago
  • Backport most mindi modifications done in the 3.2 branch into 3.0 in order to have soon a 2.1.8 version which is probably Fedora 17+ compatible (all modifications up to 2014-10-16)
  • Property svn:keywords set to Id
File size: 3.8 KB
RevLine 
[1]1#!/bin/sh
2#
[232]3# $Id: post-init 3319 2014-12-01 22:35:39Z bruno $
[1]4#
5#------------------------------------------------------------
6
[3319]7if [ -f "/tmp/mountlist.txt" ]; then
8    echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
9    cat /tmp/mountlist.txt >> $LOGFILE
10fi
[1]11
[273]12iso=`grep iso /proc/cmdline`
13nuke=`grep nuke /proc/cmdline`
[1]14if [ "$nuke" = "" ] ; then
[273]15    nuke=`grep -i "RESTORE " /proc/cmdline`
[1]16fi
[273]17expert=`grep expert /proc/cmdline`
18compare=`grep compare /proc/cmdline`
19interactive=`grep interactive /proc/cmdline`
[2098]20pxe=`grep pxe /proc/cmdline`
[1]21[ "$interactive" ]  && expert=""; # in case 'expert' crops up somewhere
22if which mondorestore > /dev/null 2> /dev/null ; then
23    LogIt "mondorestore found; cool..."
24else
[2098]25    if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
[2856]26        LogIt "The mondorestore command was not found on your backup media" 1
[2915]27        LogIt "It may mean your device is not seen correctly." 1
28        LogIt "Check driver list and error messages." 1
[739]29        exit 0
[1]30    else
[739]31        LogIt "Mindi-Linux has finished booting."
[1]32    fi
33fi
34
35if [ -h "`which mondorestore`" ] ; then
36    LogIt "Turning mondorestore from a hyperlink into an executable"
37    cat `which mondorestore` > /usr/bin/MR
38# in case there's more than one instance :)
39    rm -f `which mondorestore 2> /dev/null`
40    rm -f `which mondorestore 2> /dev/null`
41    rm -f `which mondorestore 2> /dev/null`
42    rm -f `which mondorestore 2> /dev/null`
43    mv /usr/bin/MR /usr/bin/mondorestore
44    chmod +x /usr/bin/mondorestore
45fi
46
47if which bootstrap > /dev/null 2> /dev/null ; then
48    LogIt "Calling bootstrap script" 1
49    bootstrap
50fi
51
52for i in mount-me unmount-me mondorestore ; do
53    if which $i > /dev/null 2> /dev/null ; then
54        LogIt "$i found"
55    else
56        LogIt "Warning - $i not found on ramdisk."
57    fi
58done
59
[1962]60mondoopt=""
[1983]61if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
[1962]62    mondoopt="$mondoopt -o -d $TAPEDEV"
63fi
64
65if [ "`grep -i 'debug' /proc/cmdline`" ]; then
66    mondoopt="$mondoopt -K 99"
67fi
68
[3319]69# Now suppress msg redirection to avoid poluting log file
70exec 2>&4 >&5 4>&- 5>&-
71
[1]72if [ "$compare" ] ; then
73    LogIt "------------------COMPARE MODE-----------------" 1
[1967]74    mondorestore $mondoopt -Z compare
[1]75elif [ "$nuke" ] ; then
76    LogIt "-------------------NUKE MODE-------------------" 1
[1967]77    mondorestore $mondoopt -Z nuke
[1]78elif [ "$expert" ] ; then
[1983]79    if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]80    LogIt "-------------------TAPE MODE-------------------" 1
81    loc=`which mondorestore 2> /dev/null`
82    if [ "$loc" = "" ] ; then
83        LogIt "I presume you backed up with Mindi, not Mondo." 1
84    else
85        LogIt "Tape Mode -- calling mondorestore..."
86            if [ "$nuke" ] ; then
[1967]87                mondorestore $mondoopt -Z nuke
[1]88            else
[1962]89                mondorestore $mondoopt; # MR will detect & access the tape
[1]90            fi
91    fi
[1983]92    elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]93        LogIt "------------------CDSTREAM MODE------------------" 1
94        loc=`which mondorestore 2> /dev/null`
95        if [ "$loc" = "" ] ; then
96            LogIt "I presume you backed up with Mindi, not Mondo." 1
97        else
98            LogIt "Cdstream Mode -- calling mondorestore..."
99            if [ "$nuke" ] ; then
[1967]100                mondorestore -Z nuke $mondoopt
[1]101            else
[1962]102                mondorestore $mondoopt; # MR will detect & access the cdstream
[1]103            fi
104        fi
105    else
[1612]106        LogIt "------------------EXPERT MODE------------------" 1
107        LogIt "You do all the work. :-)" 1
108        if which mondorestore > /dev/null 2> /dev/null ; then
[1]109            LogIt "Type 'mondorestore' to begin the restore/compare process." 1
110        fi
111    fi
112else
113    LogIt "------------------INTERACTIVE------------------" 1
[1967]114    mondorestore -Z interactive $mondoopt
[1]115fi
116
[1967]117[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
[1]118
119exit 0
Note: See TracBrowser for help on using the repository browser.