source: MondoRescue/branches/2.2.10/mindi/rootfs/sbin/post-init@ 2364

Last change on this file since 2364 was 2329, checked in by Bruno Cornec, 15 years ago

r3340@localhost: bruno | 2009-08-12 00:17:29 +0200
Improve portability by defining all cmdline usage in 1 include (/tmp for FreeBSD and /proc fior LInux). Also doing tht for scripts.

  • Property svn:keywords set to Id
File size: 3.5 KB
RevLine 
[1]1#!/bin/sh
2#
[232]3# $Id: post-init 2329 2009-08-18 13:20:46Z bruno $
[1]4#
5#------------------------------------------------------------
6
7sleep 1
8
[2098]9echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
[1315]10cat /tmp/mountlist.txt >> $LOGFILE
[1]11
[2329]12iso=`grep iso $CMDLINE`
13nuke=`grep nuke $CMDLINE`
[1]14if [ "$nuke" = "" ] ; then
[2329]15 nuke=`grep -i "RESTORE " $CMDLINE`
[1]16fi
[2329]17expert=`grep expert $CMDLINE`
18compare=`grep compare $CMDLINE`
19interactive=`grep interactive $CMDLINE`
20pxe=`grep pxe $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
[739]26 LogIt "FYI, this CD was made by Mindi, not Mondo." 1
27 exit 0
[1]28 else
[739]29 LogIt "Mindi-Linux has finished booting."
[1]30 fi
31fi
32
33if [ -h "`which mondorestore`" ] ; then
34 LogIt "Turning mondorestore from a hyperlink into an executable"
35 cat `which mondorestore` > /usr/bin/MR
36# in case there's more than one instance :)
37 rm -f `which mondorestore 2> /dev/null`
38 rm -f `which mondorestore 2> /dev/null`
39 rm -f `which mondorestore 2> /dev/null`
40 rm -f `which mondorestore 2> /dev/null`
41 mv /usr/bin/MR /usr/bin/mondorestore
42 chmod +x /usr/bin/mondorestore
43fi
44
45if which bootstrap > /dev/null 2> /dev/null ; then
46 LogIt "Calling bootstrap script" 1
47 bootstrap
48fi
49
50for i in mount-me unmount-me mondorestore ; do
51 if which $i > /dev/null 2> /dev/null ; then
52 LogIt "$i found"
53 else
54 LogIt "Warning - $i not found on ramdisk."
55 fi
56done
57
[1962]58mondoopt=""
[1983]59if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
[1962]60 mondoopt="$mondoopt -o -d $TAPEDEV"
61fi
62
[2329]63if [ "`grep -i 'debug' $CMDLINE`" ]; then
[1962]64 mondoopt="$mondoopt -K 99"
65fi
66
[1]67if [ "$compare" ] ; then
68 LogIt "------------------COMPARE MODE-----------------" 1
[1967]69 mondorestore $mondoopt -Z compare
[1]70elif [ "$nuke" ] ; then
71 LogIt "-------------------NUKE MODE-------------------" 1
[1967]72 mondorestore $mondoopt -Z nuke
[1]73elif [ "$expert" ] ; then
[1983]74 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]75 LogIt "-------------------TAPE MODE-------------------" 1
76 loc=`which mondorestore 2> /dev/null`
77 if [ "$loc" = "" ] ; then
78 LogIt "I presume you backed up with Mindi, not Mondo." 1
79 else
80 LogIt "Tape Mode -- calling mondorestore..."
81 if [ "$nuke" ] ; then
[1967]82 mondorestore $mondoopt -Z nuke
[1]83 else
[1962]84 mondorestore $mondoopt; # MR will detect & access the tape
[1]85 fi
86 fi
[1983]87 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]88 LogIt "------------------CDSTREAM MODE------------------" 1
89 loc=`which mondorestore 2> /dev/null`
90 if [ "$loc" = "" ] ; then
91 LogIt "I presume you backed up with Mindi, not Mondo." 1
92 else
93 LogIt "Cdstream Mode -- calling mondorestore..."
94 if [ "$nuke" ] ; then
[1967]95 mondorestore -Z nuke $mondoopt
[1]96 else
[1962]97 mondorestore $mondoopt; # MR will detect & access the cdstream
[1]98 fi
99 fi
100 else
[1612]101 LogIt "------------------EXPERT MODE------------------" 1
102 LogIt "You do all the work. :-)" 1
103 if which mondorestore > /dev/null 2> /dev/null ; then
[1]104 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
105 fi
106 fi
107else
108 LogIt "------------------INTERACTIVE------------------" 1
[1967]109 mondorestore -Z interactive $mondoopt
[1]110fi
111
[1967]112[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
[1]113
114exit 0
Note: See TracBrowser for help on using the repository browser.