source: MondoRescue/branches/2.2.9/mindi/rootfs/sbin/post-init@ 2856

Last change on this file since 2856 was 2856, checked in by Bruno Cornec, 13 years ago
  • Improve error message in case mondorestore isn't found
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1#!/bin/sh
2#
3# $Id: post-init 2856 2011-07-25 13:01:43Z bruno $
4#
5#------------------------------------------------------------
6
7
8sleep 1
9
10echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
11cat /tmp/mountlist.txt >> $LOGFILE
12
13iso=`grep iso /proc/cmdline`
14nuke=`grep nuke /proc/cmdline`
15if [ "$nuke" = "" ] ; then
16 nuke=`grep -i "RESTORE " /proc/cmdline`
17fi
18expert=`grep expert /proc/cmdline`
19compare=`grep compare /proc/cmdline`
20interactive=`grep interactive /proc/cmdline`
21pxe=`grep pxe /proc/cmdline`
22[ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
23if which mondorestore > /dev/null 2> /dev/null ; then
24 LogIt "mondorestore found; cool..."
25else
26 if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
27 LogIt "The mondorestore command was not found on your backup media" 1
28 LogIt "It may mean your device is not seen correctly. Check driver list and error messages." 1
29 exit 0
30 else
31 LogIt "Mindi-Linux has finished booting."
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
60mondoopt=""
61if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
62 mondoopt="$mondoopt -o -d $TAPEDEV"
63fi
64
65if [ "`grep -i 'debug' /proc/cmdline`" ]; then
66 mondoopt="$mondoopt -K 99"
67fi
68
69if [ "$compare" ] ; then
70 LogIt "------------------COMPARE MODE-----------------" 1
71 mondorestore $mondoopt -Z compare
72elif [ "$nuke" ] ; then
73 LogIt "-------------------NUKE MODE-------------------" 1
74 mondorestore $mondoopt -Z nuke
75elif [ "$expert" ] ; then
76 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
77 LogIt "-------------------TAPE MODE-------------------" 1
78 loc=`which mondorestore 2> /dev/null`
79 if [ "$loc" = "" ] ; then
80 LogIt "I presume you backed up with Mindi, not Mondo." 1
81 else
82 LogIt "Tape Mode -- calling mondorestore..."
83 if [ "$nuke" ] ; then
84 mondorestore $mondoopt -Z nuke
85 else
86 mondorestore $mondoopt; # MR will detect & access the tape
87 fi
88 fi
89 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
90 LogIt "------------------CDSTREAM MODE------------------" 1
91 loc=`which mondorestore 2> /dev/null`
92 if [ "$loc" = "" ] ; then
93 LogIt "I presume you backed up with Mindi, not Mondo." 1
94 else
95 LogIt "Cdstream Mode -- calling mondorestore..."
96 if [ "$nuke" ] ; then
97 mondorestore -Z nuke $mondoopt
98 else
99 mondorestore $mondoopt; # MR will detect & access the cdstream
100 fi
101 fi
102 else
103 LogIt "------------------EXPERT MODE------------------" 1
104 LogIt "You do all the work. :-)" 1
105 if which mondorestore > /dev/null 2> /dev/null ; then
106 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
107 fi
108 fi
109else
110 LogIt "------------------INTERACTIVE------------------" 1
111 mondorestore -Z interactive $mondoopt
112fi
113
114[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
115
116exit 0
Note: See TracBrowser for help on using the repository browser.