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

Last change on this file since 2890 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
RevLine 
[1]1#!/bin/sh
2#
[232]3# $Id: post-init 2856 2011-07-25 13:01:43Z 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
28 LogIt "It may mean your device is not seen correctly. Check driver list and error messages." 1
[739]29 exit 0
[1]30 else
[739]31 LogIt "Mindi-Linux has finished booting."
[1]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
[1962]60mondoopt=""
[1983]61if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
[1962]62 mondoopt="$mondoopt -o -d $TAPEDEV"
63fi
64
65if [ "`grep -i 'debug' /proc/cmdline`" ]; then
66 mondoopt="$mondoopt -K 99"
67fi
68
[1]69if [ "$compare" ] ; then
70 LogIt "------------------COMPARE MODE-----------------" 1
[1967]71 mondorestore $mondoopt -Z compare
[1]72elif [ "$nuke" ] ; then
73 LogIt "-------------------NUKE MODE-------------------" 1
[1967]74 mondorestore $mondoopt -Z nuke
[1]75elif [ "$expert" ] ; then
[1983]76 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]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
[1967]84 mondorestore $mondoopt -Z nuke
[1]85 else
[1962]86 mondorestore $mondoopt; # MR will detect & access the tape
[1]87 fi
88 fi
[1983]89 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
[1]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
[1967]97 mondorestore -Z nuke $mondoopt
[1]98 else
[1962]99 mondorestore $mondoopt; # MR will detect & access the cdstream
[1]100 fi
101 fi
102 else
[1612]103 LogIt "------------------EXPERT MODE------------------" 1
104 LogIt "You do all the work. :-)" 1
105 if which mondorestore > /dev/null 2> /dev/null ; then
[1]106 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
107 fi
108 fi
109else
110 LogIt "------------------INTERACTIVE------------------" 1
[1967]111 mondorestore -Z interactive $mondoopt
[1]112fi
113
[1967]114[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
[1]115
116exit 0
Note: See TracBrowser for help on using the repository browser.