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
RevLine 
[1]1#!/bin/sh
2#
[232]3# $Id: post-init 2915 2011-12-09 20:19:33Z bruno $
[1]4#
5#------------------------------------------------------------
6
7
8sleep 1
9
[2098]10echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
[1315]11cat /tmp/mountlist.txt >> $LOGFILE
[1]12
[273]13iso=`grep iso /proc/cmdline`
14nuke=`grep nuke /proc/cmdline`
[1]15if [ "$nuke" = "" ] ; then
[273]16 nuke=`grep -i "RESTORE " /proc/cmdline`
[1]17fi
[273]18expert=`grep expert /proc/cmdline`
19compare=`grep compare /proc/cmdline`
20interactive=`grep interactive /proc/cmdline`
[2098]21pxe=`grep pxe /proc/cmdline`
[1]22[ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
23if which mondorestore > /dev/null 2> /dev/null ; then
24 LogIt "mondorestore found; cool..."
25else
[2098]26 if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
[2856]27 LogIt "The mondorestore command was not found on your backup media" 1
[2915]28 LogIt "It may mean your device is not seen correctly." 1
29 LogIt "Check driver list and error messages." 1
[739]30 exit 0
[1]31 else
[739]32 LogIt "Mindi-Linux has finished booting."
[1]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
[1962]61mondoopt=""
[1983]62if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
[1962]63 mondoopt="$mondoopt -o -d $TAPEDEV"
64fi
65
66if [ "`grep -i 'debug' /proc/cmdline`" ]; then
67 mondoopt="$mondoopt -K 99"
68fi
69
[1]70if [ "$compare" ] ; then
71 LogIt "------------------COMPARE MODE-----------------" 1
[1967]72 mondorestore $mondoopt -Z compare
[1]73elif [ "$nuke" ] ; then
74 LogIt "-------------------NUKE MODE-------------------" 1
[1967]75 mondorestore $mondoopt -Z nuke
[1]76elif [ "$expert" ] ; then
[1983]77 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]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
[1967]85 mondorestore $mondoopt -Z nuke
[1]86 else
[1962]87 mondorestore $mondoopt; # MR will detect & access the tape
[1]88 fi
89 fi
[1983]90 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]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
[1967]98 mondorestore -Z nuke $mondoopt
[1]99 else
[1962]100 mondorestore $mondoopt; # MR will detect & access the cdstream
[1]101 fi
102 fi
103 else
[1612]104 LogIt "------------------EXPERT MODE------------------" 1
105 LogIt "You do all the work. :-)" 1
106 if which mondorestore > /dev/null 2> /dev/null ; then
[1]107 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
108 fi
109 fi
110else
111 LogIt "------------------INTERACTIVE------------------" 1
[1967]112 mondorestore -Z interactive $mondoopt
[1]113fi
114
[1967]115[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
[1]116
117exit 0
Note: See TracBrowser for help on using the repository browser.