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

Last change on this file since 2329 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
Line 
1#!/bin/sh
2#
3# $Id: post-init 2329 2009-08-18 13:20:46Z bruno $
4#
5#------------------------------------------------------------
6
7sleep 1
8
9echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
10cat /tmp/mountlist.txt >> $LOGFILE
11
12iso=`grep iso $CMDLINE`
13nuke=`grep nuke $CMDLINE`
14if [ "$nuke" = "" ] ; then
15 nuke=`grep -i "RESTORE " $CMDLINE`
16fi
17expert=`grep expert $CMDLINE`
18compare=`grep compare $CMDLINE`
19interactive=`grep interactive $CMDLINE`
20pxe=`grep pxe $CMDLINE`
21[ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
22if which mondorestore > /dev/null 2> /dev/null ; then
23 LogIt "mondorestore found; cool..."
24else
25 if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
26 LogIt "FYI, this CD was made by Mindi, not Mondo." 1
27 exit 0
28 else
29 LogIt "Mindi-Linux has finished booting."
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
58mondoopt=""
59if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
60 mondoopt="$mondoopt -o -d $TAPEDEV"
61fi
62
63if [ "`grep -i 'debug' $CMDLINE`" ]; then
64 mondoopt="$mondoopt -K 99"
65fi
66
67if [ "$compare" ] ; then
68 LogIt "------------------COMPARE MODE-----------------" 1
69 mondorestore $mondoopt -Z compare
70elif [ "$nuke" ] ; then
71 LogIt "-------------------NUKE MODE-------------------" 1
72 mondorestore $mondoopt -Z nuke
73elif [ "$expert" ] ; then
74 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
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
82 mondorestore $mondoopt -Z nuke
83 else
84 mondorestore $mondoopt; # MR will detect & access the tape
85 fi
86 fi
87 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
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
95 mondorestore -Z nuke $mondoopt
96 else
97 mondorestore $mondoopt; # MR will detect & access the cdstream
98 fi
99 fi
100 else
101 LogIt "------------------EXPERT MODE------------------" 1
102 LogIt "You do all the work. :-)" 1
103 if which mondorestore > /dev/null 2> /dev/null ; then
104 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
105 fi
106 fi
107else
108 LogIt "------------------INTERACTIVE------------------" 1
109 mondorestore -Z interactive $mondoopt
110fi
111
112[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
113
114exit 0
Note: See TracBrowser for help on using the repository browser.