home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 February / PCpro_2006_02.ISO / inst_sys / cbs / restore.ask < prev    next >
Encoding:
Text File  |  2001-11-23  |  1.2 KB  |  50 lines

  1. #!/bin/bash
  2.  
  3. ## (c) PyramidSolutions, http://www.pyramid.de
  4. ##
  5. ## ChangeLog:
  6. ## 2001.08.14 Tom    - initial version
  7. ## 2001.09.19 Tom    - changed "/restore" to "/restore -m auto"
  8. ## 2001.10.16 Tom    - added "exit 0" after debug-shell
  9. ## 2001.11.23 Tom    - shell feature: now in case-statement s*)
  10. ##            - "exit 0" -> "exec $0" (restart ..."
  11. ##            - made bash a login-shell
  12.  
  13. ## we need /proc:
  14. mount /proc    >/dev/null 2>/dev/null
  15. sleep 2
  16. ## workaround a bug:
  17. ps        >/dev/null 2>/dev/null
  18.  
  19. ## inform user what is going on:
  20. echo
  21. echo "You can start restore on serial console or local console."
  22. read -p "<ENTER> to start restore on this console."
  23.  
  24. case "$REPLY" in
  25.     s*)
  26.         echo "debug-shell ;)"
  27.         /bin/bash --login
  28.         echo "restarting $0 ..."
  29.         exec $0
  30.     ;;
  31. esac
  32.  
  33. ## check if restore is already running:
  34. ps | grep -v restore.ask | grep -q restore >/dev/null 2>/dev/null
  35. rc=$?
  36. if [ $rc -eq 0 ]; then
  37.     echo "restore is already running, cowardly refusing to do the work twice *smile*"
  38.     echo "But I'm giving you a shell to look (carefuly) what the system is doing."
  39.     echo "Have fun!"
  40.     /bin/bash
  41.     exit 0
  42. else
  43.     ## restore isn't running yet, so we start:
  44.     /restore -m auto
  45.     exit $?
  46. fi
  47.  
  48. echo "should never happen."
  49. /bin/bash
  50.