home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / init.d / boot < prev    next >
Text File  |  2006-04-20  |  7KB  |  319 lines

  1. #! /bin/bash
  2. #
  3. # Copyright (c) 1996-2004 SuSE Linux AG, Nuernberg, Germany.
  4. # All rights reserved.
  5. #
  6. # Author: Ruediger Oertel <ro@suse.de>, 1996-2002
  7. #         Werner Fink <werner@suse.de>, 1996-2004
  8. #         Burchard Steinbild, 1996-2000
  9. #         Florian La Roche, 1996
  10. #
  11. # Please send feedback to http://www.suse.de/feedback
  12. #
  13. # /etc/init.d/boot
  14. #
  15. # first script to be executed from init on system startup
  16. #
  17.  
  18. #
  19. # Avoid be interrupted by child or keyboard
  20. trap "echo" SIGINT SIGSEGV SIGQUIT
  21. set +e
  22.  
  23. #
  24. # Get terminal size of standard input of the system console
  25. #
  26. test -z "$CONSOLE" && CONSOLE=/dev/console
  27. set -- $(stty size < $CONSOLE)
  28.   LINES=$1
  29. COLUMNS=$2
  30. export LINES COLUMNS CONSOLE
  31.  
  32. #
  33. # Set I/O of this script and its childs to console
  34. #
  35. exec 0<> $CONSOLE 1>&0 2>&0
  36.  
  37. #
  38. # Export the real device in variable REDIRECT.
  39. #
  40. REDIRECT="`showconsole 2>/dev/null`"
  41. export REDIRECT
  42. if test $COLUMNS -eq 0 ; then
  43.     # Serial: columns and lines are not defined
  44.       LINES=24
  45.     COLUMNS=80
  46.     test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102
  47. fi
  48.  
  49. #
  50. # Configuration and coloring of the boot messages
  51. #
  52.  
  53. . /etc/rc.status
  54. . /etc/sysconfig/boot
  55.  
  56. echo -n "System Boot Control: "
  57. echo "Running $0"
  58.  
  59. #
  60. # Start of e.g. blogd, requires /proc and /dev/pts.
  61. #
  62. rc_reset
  63. echo -n "Mounting procfs at /proc"
  64. mount -n -t proc proc /proc
  65. rc_status -v -r
  66.  
  67. echo -n "Mounting sysfs at /sys"
  68. mount -n -t sysfs sysfs /sys
  69. rc_status -v -r
  70.  
  71. if test -d /sys/kernel/debug ; then
  72.     while read dev type ; do
  73.     if test "$type" = "debugfs" ; then
  74.         echo -n "Mounting debugfs at /sys/kernel/debug"
  75.         mount -n -t debugfs debugfs /sys/kernel/debug
  76.         rc_status -v -r
  77.     fi
  78.     done < /proc/filesystems
  79. fi
  80. #
  81. # mount tmpfs on /dev if not already done by initramfs
  82. #
  83. while read dev dir type options; do
  84.     if test "$dir" = "/dev" -a "$type" = "tmpfs"; then
  85.     DEV_MOUNTED=1;
  86.     break;
  87.     fi
  88. done < /proc/mounts
  89. if test -z "$DEV_MOUNTED"; then
  90.     echo -n "Mounting tmpfs at /dev"
  91.     mount -n -t tmpfs -o mode=0755 udev /dev
  92.     rc_status -v -r
  93. fi
  94.  
  95. #
  96. # populate /dev with initial content
  97. #
  98. echo -n "Initializing /dev"
  99. cp --preserve=all --recursive --remove-destination /lib/udev/devices/* /dev
  100. chmod 1777 /dev/shm
  101. rc_status -v -r
  102.  
  103. echo -n "Mounting devpts at /dev/pts"
  104. mount -n -t devpts -o mode=0620,gid=5 devpts /dev/pts
  105. rc_status -v -r
  106.  
  107. #
  108. # Save old terminal settings and set -nl to avoid staircase
  109. # effect, do not lock scrolling, and avoid break characters.
  110. #
  111. otty=$(stty -g)
  112. if test "$FLOW_CONTROL" = "yes" ; then
  113.     stty -nl  ixon ignbrk -brkint
  114. else
  115.     stty -nl -ixon ignbrk -brkint
  116. fi
  117.  
  118. #
  119. # Should we ask for interactive boot mode
  120. #
  121. DO_CONFIRM=""
  122. read -t 2 check < /proc/cmdline 2> /dev/null
  123. case "$check" in
  124.     *confirm*) DO_CONFIRM=yes ;;
  125. esac
  126. test -z "$CONFIRM_PROMPT_TIMEOUT" && CONFIRM_PROMPT_TIMEOUT=5
  127. if test "$PROMPT_FOR_CONFIRM" = "yes" -a "$DO_CONFIRM" != "yes" ; then
  128.     echo -en "${extd}Enter Interactive startup mode?${norm}"
  129.     rc_timer_on "$CONFIRM_PROMPT_TIMEOUT" 37
  130.     read -t "$CONFIRM_PROMPT_TIMEOUT" -n 1 \
  131.     -p " ${extd}y${norm}/[${extd}n${norm}]("${CONFIRM_PROMPT_TIMEOUT}s") " answer
  132.     rc_timer_off
  133.     case "$answer" in
  134.     [yYiI]) DO_CONFIRM=yes ;;
  135.     *)      DO_CONFIRM=    ;;
  136.     esac
  137.     unset answer
  138.     echo
  139. fi
  140. export DO_CONFIRM
  141.  
  142. #
  143. # Start blogd, requires /proc and /dev/pts.
  144. # Export the real device in variable REDIRECT.
  145. #
  146. test -x /sbin/blogd -a -n "$REDIRECT" && /sbin/blogd $REDIRECT
  147. if test -z "$REDIRECT" ; then
  148.     if (echo -n > /dev/tty) 2>/dev/null ; then
  149.     REDIRECT=/dev/tty
  150.     else
  151.     REDIRECT=/dev/console
  152.     fi
  153. fi
  154.  
  155. #
  156. # Common used variables
  157. #
  158. bootrc=/etc/init.d/boot.d
  159. rex="[0-9][0-9]"
  160. failed=""
  161. skipped=""
  162. callord=""
  163.  
  164. #
  165. # Initialize boosplash progressbar variables
  166. #
  167. . /etc/rc.splash B
  168. splashtrigger "rlchange B"
  169.  
  170. #
  171. # Check if we are able to use make for booting
  172. #
  173. test -s /etc/init.d/.depend.boot || RUN_PARALLEL="no"
  174. test -s /etc/init.d/Makefile     || RUN_PARALLEL="no"
  175. test "$DO_CONFIRM"   = "yes"     && RUN_PARALLEL="no"
  176. type -p startpar &> /dev/null    || RUN_PARALLEL="no"
  177. startpar -v &> /dev/null     || RUN_PARALLEL="no"
  178.  
  179. #
  180. # Start bootup client scripts.
  181. #
  182. if test "$RUN_PARALLEL" = "yes" ; then
  183.  
  184.     #
  185.     # Start scripts in parallel with make behaviour of startpar
  186.     #
  187.  
  188.     startopt="-p4 -t 30 -T 3 $(splashmake)"
  189.     eval $(startpar $startopt -M boot)
  190.     failed="${failed:+$failed }$failed_service"
  191.     skipped="${skipped:+$skipped }$skipped_service"
  192.  
  193.     unset failed_service skipped_service startopt
  194.  
  195. elif test -d ${bootrc}/ ; then
  196.  
  197.     #
  198.     # Start scripts in given link order
  199.     #
  200.     for i in ${bootrc}/S${rex}*; do
  201.  
  202.     test -f $i || continue
  203.  
  204.     B=${i##*/}
  205.     script=${B#*S$rex}
  206.     B=${B%$script}
  207.  
  208.     if test "$DO_CONFIRM" = "yes" ; then
  209.         rc_confirm -t 5 "Start bootup script ${script}" < $REDIRECT > $REDIRECT 2>&1
  210.         case "$?" in
  211.         0) true     ;;
  212.         1) continue ;;
  213.         2) DO_CONFIRM=""
  214.         esac
  215.     fi
  216.  
  217.     blogger "$script start"
  218.  
  219.     if test -x "$i" ; then
  220.         $i start
  221.     else
  222.         echo Running $i
  223.         /bin/sh $i b
  224.         rc_status -v1 -r
  225.     fi
  226.     status=$?
  227.     echo -en "$rc_reset"
  228.     splashprogress "$script start"
  229.  
  230.     case $status in
  231.     [1-47])  failed="${failed:+$failed }$script"   ;;
  232.     [56])   skipped="${skipped:+$skipped }$script" ;;
  233.     0|*) ;;
  234.     esac
  235.  
  236.     blogger "'$script start' exits with status $status"
  237.     done
  238. fi
  239.  
  240. splashtrigger "rlreached B"
  241.  
  242. #
  243. # Be verbose and print stats
  244. #
  245. echo -n "System Boot Control: "
  246. echo -e "The system has been ${stat}${extd}set up${norm}"
  247. if test -n "$failed" ; then
  248.     n=$((${#failed} + 7))
  249.     echo -n  "Failed features: "
  250.     test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D"
  251.     echo -e  "${warn}${failed}${norm}"
  252. fi
  253. if test -n "$skipped" ; then
  254.     n=$((${#skipped} + 7))
  255.     echo -n  "Skipped features: "
  256.     test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D"
  257.     echo -e  "${attn}${skipped}${norm}"
  258. fi
  259.  
  260. #
  261. # Start user defined bootup script.
  262. #
  263. if test -f /etc/init.d/boot.local ; then
  264.     echo -n "System Boot Control: "
  265.     echo "Running /etc/init.d/boot.local"
  266.     /bin/sh /etc/init.d/boot.local
  267.     rc_status -v1 -r
  268.     splashtrigger "boot.local"
  269. fi
  270.  
  271. #
  272. # Stop blogd
  273. #
  274. test -x /sbin/blogd && killproc -QUIT /sbin/blogd
  275.  
  276. #
  277. # Check for boot cycle detection
  278. #
  279. test -s /lib/bootcycle/stats && . /lib/bootcycle/stats
  280.  
  281. #
  282. # Remember for master resource script
  283. #
  284. if test "$DO_CONFIRM" = "yes" ; then
  285.     touch /var/run/do_confirm
  286. fi
  287.  
  288. #
  289. # Restore old terminal settings
  290. #
  291. stty $otty
  292.  
  293. #
  294. # Let YaST2 finish its installation, if you installed with YaST2
  295. #
  296. if test -f /var/lib/YaST2/runme_at_boot ; then
  297.     HOSTTYPE=$(uname -m)
  298.     splashtrigger "YaST"
  299.     exec 0<> $REDIRECT 1>&0 2>&0
  300.     # if yast2 failed, this ensures proper system setup
  301.     #ulimit -c unlimited
  302.     touch /var/lib/YaST2/run_suseconfig
  303.     if test -x /usr/lib/YaST2/startup/YaST2.Second-Stage; then
  304.     /usr/lib/YaST2/startup/YaST2.Second-Stage
  305.     else
  306.     # oops, yast2 not installed
  307.     rm -f /var/lib/YaST2/runme_at_boot
  308.     fi
  309. fi
  310. # run SuSEconfig (with args) if needed
  311. if test -f /var/lib/YaST2/run_suseconfig ; then
  312.     /sbin/SuSEconfig `cat /var/lib/YaST2/run_suseconfig`
  313.     rm -f /var/lib/YaST2/run_suseconfig
  314. fi
  315.  
  316. rc_reset
  317. exit 0
  318.