home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / init.d / ubiquity < prev    next >
Encoding:
Text File  |  2009-04-09  |  2.7 KB  |  125 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          ubiquity
  4. # Required-Start:    $remote_fs $syslog $time hal
  5. # Required-Stop:     $remote_fs $syslog $time hal
  6. # X-Start-Before:    gdm kdm xdm
  7. # X-Stop-After:      gdm kdm xdm
  8. # Default-Start:     2 3 4 5
  9. # Default-Stop:
  10. # Short-Description: Ubuntu live CD installer
  11. # Description:       Installs Ubuntu from a live CD. This only does anything
  12. #                    if told to do so by parameters on the kernel command
  13. #                    line; otherwise, the installer may be started manually
  14. #                    later.
  15. ### END INIT INFO
  16.  
  17. set -e
  18.  
  19. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  20. NAME=ubiquity
  21.  
  22. test -x /usr/bin/ubiquity-dm || exit 0
  23.  
  24. ubiquity=
  25. automatic=
  26. debug=
  27. noninteractive=
  28. for x in $(cat /proc/cmdline); do
  29.     case $x in
  30.         debug-ubiquity)
  31.             debug="-d"
  32.             ubiquity=1
  33.             ;;
  34.         automatic-ubiquity)
  35.             automatic="--automatic"
  36.             ubiquity=1
  37.             ;;
  38.         only-ubiquity)
  39.             ubiquity=1
  40.             ;;
  41.         noninteractive)
  42.             ubiquity=1
  43.             noninteractive=1
  44.             ;;
  45.     esac
  46. done
  47. if [ -z "$ubiquity" ] && [ "$1" != force-start ]; then
  48.     exit 0
  49. fi
  50.     
  51. if [ -r /etc/environment ]; then
  52.     if LANG=$(pam_getenv -l LANG); then
  53.         export LANG
  54.     fi
  55.     if LANGUAGE=$(pam_getenv -l LANGUAGE); then
  56.         export LANGUAGE
  57.     fi
  58. fi
  59.  
  60. . /lib/lsb/init-functions
  61.  
  62. case "$1" in
  63.     start|force-start)
  64.         if [ -x /etc/init.d/NetworkManager ]; then
  65.             /etc/init.d/NetworkManager start
  66.         elif [ -x /etc/init.d/network-manager ]; then
  67.             /etc/init.d/network-manager start
  68.         fi
  69.         log_begin_msg "Starting Ubiquity..."
  70.         # if usplash is running, make sure to stop it now, yes "start" kills it.
  71.         if pidof usplash > /dev/null; then
  72.             usplash=:
  73.             orig_console="$(fgconsole)"
  74.             DO_NOT_SWITCH_VT=yes /etc/init.d/usplash start
  75.             # We've just shut down usplash, so don't log
  76.             # success as it will look weird on the console.
  77.             log_end_msg=:
  78.         else
  79.             usplash=false
  80.             log_end_msg=log_end_msg
  81.         fi
  82.         # turn off console blanking for install process
  83.         setterm -blank 0
  84.         if [ -n "$noninteractive" ]; then
  85.             cmd="ubiquity noninteractive"
  86.         else
  87.             # Run in the foreground.
  88.             cmd="ubiquity-dm vt7 :0 /usr/bin/ubiquity $debug $automatic --only"
  89.             if ${cmd}; then
  90.                 cmd="/bin/true"
  91.             else
  92.                 cmd="ubiquity noninteractive"
  93.             fi
  94.         fi
  95.         if ${cmd}; then
  96.             $log_end_msg 0
  97.         else
  98.             log_end_msg $?
  99.         fi
  100.  
  101.         if $usplash && [ "$orig_console" != serial ]; then
  102.             # Wait a short while for the active console to
  103.             # change, to try to avoid visible console noise from
  104.             # later init scripts.
  105.             i=0
  106.             while [ "$(fgconsole)" = "$orig_console" ]; do
  107.                 i="$(($i + 1))"
  108.                 if [ "$i" -gt 5 ]; then
  109.                     break
  110.                 fi
  111.                 sleep 1
  112.             done
  113.         fi
  114.     ;;
  115.     stop|restart|force-reload)
  116.     ;;
  117.     *)
  118.         N=/etc/init.d/$NAME
  119.         echo "Usage: $N {start|force-start|stop|restart|force-reload}" >&2
  120.         exit 1
  121.     ;;
  122. esac
  123.  
  124. exit 0
  125.