Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # rc-sysinit - System V initialisation compatibility
- #
- # This task runs the old System V-style system initialisation scripts,
- # and enters the default runlevel when finished.
- description "System V initialisation compatibility"
- author "Scott James Remnant <scott@netsplit.com>"
- start on (filesystem and static-network-up) or failsafe-boot
- stop on runlevel
- # Default runlevel, this may be overriden on the kernel command-line
- # or by faking an old /etc/inittab entry
- env DEFAULT_RUNLEVEL=2
- emits runlevel
- # There can be no previous runlevel here, but there might be old
- # information in /var/run/utmp that we pick up, and we don't want
- # that.
- #
- # These override that
- env RUNLEVEL=
- env PREVLEVEL=
- console output
- env INIT_VERBOSE
- task
- script
- # Check for default runlevel in /etc/inittab
- if [ -r /etc/inittab ]; then
- eval "$(sed -nre 's/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' /etc/inittab || true)"
- fi
- # Check kernel command-line for typical arguments
- for ARG in $(cat /proc/cmdline); do
- case "${ARG}" in
- rootboot=*)
- # autologin root - set custom kernel param rootboot=1
- # exec /bin/bash --login < /dev/console > /dev/console 2>&1
- # ...no echo
- # exec /bin/login -f root < /dev/tty0 > /dev/tty0 2>&1
- # This works
- # exec /sbin/rungetty -u root tty0 /root/bin/my_autologin
- #exec /sbin/rungetty -u root tty0 /root/bin/my_autologin
- # this works, but no console echo either
- # exec /bin/bash --login < /dev/console>/dev/console 2>&1
- exec /sbin/rungetty --autologin root tty0
- ;;
- -b|emergency)
- # Emergency shell
- [ -n "${FROM_SINGLE_USER_MODE}" ] || sulogin
- ;;
- [0123456sS])
- # Override runlevel
- DEFAULT_RUNLEVEL="${ARG}"
- ;;
- -s|single)
- # Single user mode
- [ -n "${FROM_SINGLE_USER_MODE}" ] || DEFAULT_RUNLEVEL=S
- ;;
- esac
- done
- # Run the system initialisation scripts
- [ -n "${FROM_SINGLE_USER_MODE}" ] || /etc/init.d/rcS
- # Switch into the default runlevel
- telinit "${DEFAULT_RUNLEVEL}"
- end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement