home *** CD-ROM | disk | FTP | other *** search
- #!/bin/bash
-
- ## (c) PyramidSolutions, http://www.pyramid.de
- ##
- ## ChangeLog:
- ## 2001.08.14 Tom - initial version
- ## 2001.09.19 Tom - changed "/restore" to "/restore -m auto"
- ## 2001.10.16 Tom - added "exit 0" after debug-shell
- ## 2001.11.23 Tom - shell feature: now in case-statement s*)
- ## - "exit 0" -> "exec $0" (restart ..."
- ## - made bash a login-shell
-
- ## we need /proc:
- mount /proc >/dev/null 2>/dev/null
- sleep 2
- ## workaround a bug:
- ps >/dev/null 2>/dev/null
-
- ## inform user what is going on:
- echo
- echo "You can start restore on serial console or local console."
- read -p "<ENTER> to start restore on this console."
-
- case "$REPLY" in
- s*)
- echo "debug-shell ;)"
- /bin/bash --login
- echo "restarting $0 ..."
- exec $0
- ;;
- esac
-
- ## check if restore is already running:
- ps | grep -v restore.ask | grep -q restore >/dev/null 2>/dev/null
- rc=$?
- if [ $rc -eq 0 ]; then
- echo "restore is already running, cowardly refusing to do the work twice *smile*"
- echo "But I'm giving you a shell to look (carefuly) what the system is doing."
- echo "Have fun!"
- /bin/bash
- exit 0
- else
- ## restore isn't running yet, so we start:
- /restore -m auto
- exit $?
- fi
-
- echo "should never happen."
- /bin/bash
-