source: branches/2.2.8/mindi/rootfs/sbin/post-init @ 2098

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