-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrc.single
executable file
·47 lines (40 loc) · 1.09 KB
/
rc.single
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
. /etc/rc.conf
. /etc/rc.subr
if [ "$PREVLEVEL" = "2" ]; then
if [ "$DAEMONS" ]; then
for daemon in $DAEMONS; do
R_DAEMONS="$daemon $R_DAEMONS"
done
for daemon in $R_DAEMONS; do
if [ -x /etc/rc.d/$daemon ]; then
/etc/rc.d/$daemon stop
fi
done
fi
fi
if [ "$PREVLEVEL" != "N" ]; then
msg "Sending all processes the TERM signal..."
killall5 -15
sleep 1
msg "Sending all processes the KILL signal..."
killall5 -9
msg "Mounting virtual file systems..."
mountpoint -q /run || mount /run
mountpoint -q /proc || mount -o nosuid,noexec,nodev /proc
mountpoint -q /sys || mount -o nosuid,noexec,nodev /sys
mountpoint -q /dev || mount -o mode=0755,nosuid /dev
mkdir -p /run/lock /run/shm /dev/pts
chmod 1777 /run/shm /run/lock
ln -sfn /run/shm /dev/shm
msg "Starting udev and waiting for devices to settle..."
udevd --daemon
udevadm trigger --action=add --type=subsystems
udevadm trigger --action=add --type=devices
udevadm trigger --action=change --type=devices
udevadm settle
fi
if [ "$RUNLEVEL" = "1" ]; then
# Enter single-user mode
exec init -t1 S
fi