mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
71 lines
1.5 KiB
Text
71 lines
1.5 KiB
Text
|
#!/bin/bash
|
||
|
#
|
||
|
# /etc/rc.single: Single-user startup script.
|
||
|
#
|
||
|
|
||
|
. /etc/rc.conf
|
||
|
. /etc/rc.d/functions
|
||
|
|
||
|
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
|
||
|
# Find daemons NOT in the DAEMONS array. Shut these down first
|
||
|
if [ -d /var/run/daemons ]; then
|
||
|
for daemon in $(/bin/ls -1t /var/run/daemons); do
|
||
|
if ! in_array $daemon ${DAEMONS[@]}; then
|
||
|
stop_daemon $daemon
|
||
|
fi
|
||
|
done
|
||
|
fi
|
||
|
# Shutdown daemons in reverse order
|
||
|
let i=${#DAEMONS[@]}-1
|
||
|
while [ $i -ge 0 ]; do
|
||
|
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
|
||
|
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
|
||
|
fi
|
||
|
let i=i-1
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
if [ "$PREVLEVEL" != "N" ]; then
|
||
|
stat_busy "Sending SIGTERM To Processes"
|
||
|
/sbin/killall5 -15 &> /dev/null
|
||
|
/bin/sleep 5
|
||
|
stat_done
|
||
|
|
||
|
stat_busy "Sending SIGKILL To Processes"
|
||
|
/sbin/killall5 -9
|
||
|
/bin/sleep 1
|
||
|
stat_done
|
||
|
|
||
|
if [ -x /sbin/udevadm ]; then
|
||
|
stat_busy "Starting UDev Daemon"
|
||
|
/sbin/udevd --daemon
|
||
|
stat_done
|
||
|
stat_busy "Loading UDev uevents"
|
||
|
/sbin/udevadm trigger
|
||
|
/sbin/udevadm settle
|
||
|
stat_done
|
||
|
else
|
||
|
# Static /dev, our last resort
|
||
|
status "Using static /dev filesystem" /bin/true
|
||
|
fi
|
||
|
|
||
|
# try syslog-NG first, then fall back to good ol' syslogd
|
||
|
if [ -x /etc/rc.d/syslog-ng ]; then
|
||
|
/etc/rc.d/syslog-ng start
|
||
|
elif [ -x /etc/rc.d/syslogd ]; then
|
||
|
/etc/rc.d/syslogd start
|
||
|
[ -x /etc/rc.d/klogd ] && /etc/rc.d/klogd start
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
if [ "$RUNLEVEL" = "1" ]; then
|
||
|
printsep
|
||
|
printhl "Entering single-user mode..."
|
||
|
# make sure /dev/initctl is in place
|
||
|
/bin/kill -HUP 1
|
||
|
exec /sbin/init -t1 S
|
||
|
fi
|
||
|
|
||
|
# End of file
|
||
|
# vim: set ts=2 noet:
|