source: MondoRescue/branches/3.2/mindi/rootfs/sbin/post-init@ 3203

Last change on this file since 3203 was 3203, checked in by Bruno Cornec, 10 years ago
  • Test /tmp/mountlist.txt existence before using it in mindi, as mindi can be use in standalone mode without mondoarchive creating that file
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1#!/bin/sh
2#
3# $Id: post-init 3203 2013-12-06 14:40:40Z bruno $
4#
5#------------------------------------------------------------
6
7
8sleep 1
9
10if [ -f "/tmp/mountlist.txt" ]; then
11 echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
12 cat /tmp/mountlist.txt >> $LOGFILE
13fi
14
15iso=`grep iso /proc/cmdline`
16nuke=`grep nuke /proc/cmdline`
17if [ "$nuke" = "" ] ; then
18 nuke=`grep -i "RESTORE " /proc/cmdline`
19fi
20expert=`grep expert /proc/cmdline`
21compare=`grep compare /proc/cmdline`
22interactive=`grep interactive /proc/cmdline`
23pxe=`grep pxe /proc/cmdline`
24[ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
25if which mondorestore > /dev/null 2> /dev/null ; then
26 LogIt "mondorestore found; cool..."
27else
28 if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
29 LogIt "The mondorestore command was not found on your backup media" 1
30 LogIt "It may mean your device is not seen correctly." 1
31 LogIt "Check driver list and error messages." 1
32 exit 0
33 else
34 LogIt "Mindi-Linux has finished booting."
35 fi
36fi
37
38if [ -h "`which mondorestore`" ] ; then
39 LogIt "Turning mondorestore from a hyperlink into an executable"
40 cat `which mondorestore` > /usr/bin/MR
41# in case there's more than one instance :)
42 rm -f `which mondorestore 2> /dev/null`
43 rm -f `which mondorestore 2> /dev/null`
44 rm -f `which mondorestore 2> /dev/null`
45 rm -f `which mondorestore 2> /dev/null`
46 mv /usr/bin/MR /usr/bin/mondorestore
47 chmod +x /usr/bin/mondorestore
48fi
49
50if which bootstrap > /dev/null 2> /dev/null ; then
51 LogIt "Calling bootstrap script" 1
52 bootstrap
53fi
54
55for i in mount-me unmount-me mondorestore ; do
56 if which $i > /dev/null 2> /dev/null ; then
57 LogIt "$i found"
58 else
59 LogIt "Warning - $i not found on ramdisk."
60 fi
61done
62
63mondoopt=""
64if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
65 mondoopt="$mondoopt -o -d $TAPEDEV"
66fi
67
68if [ "`grep -i 'debug' /proc/cmdline`" ]; then
69 mondoopt="$mondoopt -K 99"
70fi
71
72if [ "$compare" ] ; then
73 LogIt "------------------COMPARE MODE-----------------" 1
74 mondorestore $mondoopt -Z compare
75elif [ "$nuke" ] ; then
76 LogIt "-------------------NUKE MODE-------------------" 1
77 mondorestore $mondoopt -Z nuke
78elif [ "$expert" ] ; then
79 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
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
87 mondorestore $mondoopt -Z nuke
88 else
89 mondorestore $mondoopt; # MR will detect & access the tape
90 fi
91 fi
92 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
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
100 mondorestore -Z nuke $mondoopt
101 else
102 mondorestore $mondoopt; # MR will detect & access the cdstream
103 fi
104 fi
105 else
106 LogIt "------------------EXPERT MODE------------------" 1
107 LogIt "You do all the work. :-)" 1
108 if which mondorestore > /dev/null 2> /dev/null ; then
109 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
110 fi
111 fi
112else
113 LogIt "------------------INTERACTIVE------------------" 1
114 mondorestore -Z interactive $mondoopt
115fi
116
117[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
118
119exit 0
Note: See TracBrowser for help on using the repository browser.