Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. # rc - System V runlevel compatibility
  2. #
  3. # This task runs the old System V-style rc script when changing between
  4. # runlevels.
  5.  
  6. description "System V runlevel compatibility"
  7. author "Scott James Remnant <scott@netsplit.com>"
  8.  
  9. emits deconfiguring-networking
  10. emits unmounted-remote-filesystems
  11.  
  12. start on runlevel [0123456]
  13. stop on runlevel [!$RUNLEVEL]
  14.  
  15. export RUNLEVEL
  16. export PREVLEVEL
  17.  
  18. task
  19.  
  20. console output
  21. exec /etc/init.d/rc $RUNLEVEL
  22.  
  23.  
  24. # rc-sysinit - System V initialisation compatibility
  25. #
  26. # This task runs the old System V-style system initialisation scripts,
  27. # and enters the default runlevel when finished.
  28.  
  29. description "System V initialisation compatibility"
  30. author "Scott James Remnant <scott@netsplit.com>"
  31.  
  32. start on (filesystem and static-network-up) or failsafe-boot
  33. stop on runlevel
  34.  
  35.  
  36.  
  37. # Default runlevel, this may be overriden on the kernel command-line
  38. # or by faking an old /etc/inittab entry
  39. env DEFAULT_RUNLEVEL=2
  40.  
  41. emits runlevel
  42.  
  43. # There can be no previous runlevel here, but there might be old
  44. # information in /var/run/utmp that we pick up, and we don't want
  45. # that.
  46. #
  47. # These override that
  48. env RUNLEVEL=
  49. env PREVLEVEL=
  50.  
  51. task
  52.  
  53. console owner
  54. script
  55. # Check for default runlevel in /etc/inittab
  56. if [ -r /etc/inittab ]
  57. then
  58. eval "$(sed -nre 's/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' /etc/inittab || true)"
  59. fi
  60.  
  61. # Check kernel command-line for typical arguments
  62. for ARG in $(cat /proc/cmdline)
  63. do
  64. case "${ARG}" in
  65. -b|emergency)
  66. # Emergency shell
  67. [ -n "${FROM_SINGLE_USER_MODE}" ] || sulogin
  68. ;;
  69. [0123456sS])
  70. # Override runlevel
  71. DEFAULT_RUNLEVEL="${ARG}"
  72. ;;
  73. -s|single)
  74. # Single user mode
  75. [ -n "${FROM_SINGLE_USER_MODE}" ] || DEFAULT_RUNLEVEL=S
  76. ;;
  77. esac
  78. done
  79.  
  80. # Run the system initialisation scripts
  81. [ -n "${FROM_SINGLE_USER_MODE}" ] || /etc/init.d/rcS
  82.  
  83. # Switch into the default runlevel
  84. telinit "${DEFAULT_RUNLEVEL}"
  85. end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement