aboutsummaryrefslogtreecommitdiff
path: root/rc.single
blob: 74368fd282c46e6bdc3812b50c4eb64aefbd574c (plain)
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
48
49
50
51
52
53
54
55
#!/bin/bash
#
# /etc/rc.single: Single-user startup script.
#

. /etc/rc.conf
. /etc/rc.d/functions

export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

run_hook single_start

if [[ $PREVLEVEL != N ]]; then
	kill_everything single
	
	status "Starting UDev Daemon" udevd --daemon
	
	run_hook single_udevlaunched

	# Trigger udev uevents
	stat_busy "Triggering UDev uevents"
		udevadm trigger --action=add --type=subsystems
		udevadm trigger --action=add --type=devices
	stat_done

	# Wait for udev uevents
	status "Waiting for UDev uevents to be processed" \
		udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}

	run_hook single_udevsettled

	# start up our mini logger until syslog takes over
	minilogd
fi

run_hook single_end

if [[ -f /run/bootlogd.pid ]]; then
	touch /var/log/boot
	kill $(< /run/bootlogd.pid)
	rm -f /run/bootlogd.pid
	sed -i -r -e 's/\^\[\[[0-9]?;?[0-9]?[0-9]?;?[0-9]?[0-9]?[ms]//g' \
                  -e 's/\^\[(\[151|%)G//g' /var/log/boot
fi

if [[ $RUNLEVEL = 1 ]]; then
	printsep
	printhl "Entering single-user mode..."
	# make sure /dev/initctl is in place
	kill -HUP 1
	exec init -t1 S
fi

# End of file
# vim: set ts=2 sw=2 noet: