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

Last change on this file since 2915 was 2915, checked in by Bruno Cornec, 12 years ago
  • Force block size back to 32768 in OBDR mode after skipping the 2 tape marks, to read the additional rootfs data corerctly - Fix #593 and #358 for good it seems
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1#!/bin/sh
2#
3# $Id: post-init 2915 2011-12-09 20:19:33Z 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." 1
29 LogIt "Check driver list and error messages." 1
30 exit 0
31 else
32 LogIt "Mindi-Linux has finished booting."
33 fi
34fi
35
36if [ -h "`which mondorestore`" ] ; then
37 LogIt "Turning mondorestore from a hyperlink into an executable"
38 cat `which mondorestore` > /usr/bin/MR
39# in case there's more than one instance :)
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 rm -f `which mondorestore 2> /dev/null`
44 mv /usr/bin/MR /usr/bin/mondorestore
45 chmod +x /usr/bin/mondorestore
46fi
47
48if which bootstrap > /dev/null 2> /dev/null ; then
49 LogIt "Calling bootstrap script" 1
50 bootstrap
51fi
52
53for i in mount-me unmount-me mondorestore ; do
54 if which $i > /dev/null 2> /dev/null ; then
55 LogIt "$i found"
56 else
57 LogIt "Warning - $i not found on ramdisk."
58 fi
59done
60
61mondoopt=""
62if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
63 mondoopt="$mondoopt -o -d $TAPEDEV"
64fi
65
66if [ "`grep -i 'debug' /proc/cmdline`" ]; then
67 mondoopt="$mondoopt -K 99"
68fi
69
70if [ "$compare" ] ; then
71 LogIt "------------------COMPARE MODE-----------------" 1
72 mondorestore $mondoopt -Z compare
73elif [ "$nuke" ] ; then
74 LogIt "-------------------NUKE MODE-------------------" 1
75 mondorestore $mondoopt -Z nuke
76elif [ "$expert" ] ; then
77 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
78 LogIt "-------------------TAPE MODE-------------------" 1
79 loc=`which mondorestore 2> /dev/null`
80 if [ "$loc" = "" ] ; then
81 LogIt "I presume you backed up with Mindi, not Mondo." 1
82 else
83 LogIt "Tape Mode -- calling mondorestore..."
84 if [ "$nuke" ] ; then
85 mondorestore $mondoopt -Z nuke
86 else
87 mondorestore $mondoopt; # MR will detect & access the tape
88 fi
89 fi
90 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
91 LogIt "------------------CDSTREAM MODE------------------" 1
92 loc=`which mondorestore 2> /dev/null`
93 if [ "$loc" = "" ] ; then
94 LogIt "I presume you backed up with Mindi, not Mondo." 1
95 else
96 LogIt "Cdstream Mode -- calling mondorestore..."
97 if [ "$nuke" ] ; then
98 mondorestore -Z nuke $mondoopt
99 else
100 mondorestore $mondoopt; # MR will detect & access the cdstream
101 fi
102 fi
103 else
104 LogIt "------------------EXPERT MODE------------------" 1
105 LogIt "You do all the work. :-)" 1
106 if which mondorestore > /dev/null 2> /dev/null ; then
107 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
108 fi
109 fi
110else
111 LogIt "------------------INTERACTIVE------------------" 1
112 mondorestore -Z interactive $mondoopt
113fi
114
115[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
116
117exit 0
Note: See TracBrowser for help on using the repository browser.