summaryrefslogtreecommitdiffstats
path: root/utils/plymouth/files/plymouth.init
blob: 966dc8b2120e0e5faa2b3737b1641b45d4f348fb (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
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh /etc/rc.common

START=11
STOP=06

PIDFILE=/var/run/plymouth.pid

running() {
	/usr/bin/plymouth --ping 2>/dev/null
}

boot() {
	start "$@"
}

start() {
	# The KMS device is not always card0; a render-only node can
	# enumerate first.
	ls /dev/dri/card* >/dev/null 2>&1 || return 0
	running && return 0

	# --graphical-boot asks for the themed splash without a "splash"
	# kernel argument and keeps plymouth away from the console, which on
	# a board without a VT would otherwise be its serial port.
	/usr/sbin/plymouthd --mode=boot --pid-file="$PIDFILE" \
		--graphical-boot || return 1
	/usr/bin/plymouth show-splash
}

# Give the display up without going away. The daemon keeps the device
# open and the mode configured, so whatever draws next inherits a live
# crtc, and the splash can return later without a second modeset.
release() {
	running || return 0
	/usr/bin/plymouth deactivate
}

stop() {
	running || return 0
	/usr/bin/plymouth quit --retain-splash
	rm -f "$PIDFILE"
}

# procd runs the K scripts as "shutdown", so this is the start of that
# sequence rather than the end. Take the display back from whoever has
# it, reusing the daemon that has been there since boot.
shutdown() {
	ls /dev/dri/card* >/dev/null 2>&1 || return 0
	[ -x /usr/sbin/plymouthd ] || return 0

	if running; then
		/usr/bin/plymouth reactivate
		/usr/bin/plymouth change-mode --shutdown
		/usr/bin/plymouth show-splash
		return 0
	fi

	/usr/sbin/plymouthd --mode=shutdown --pid-file="$PIDFILE" \
		--graphical-boot || return 0
	/usr/bin/plymouth show-splash
}

reload() {
	/usr/bin/plymouth update --status=reload
}

EXTRA_COMMANDS="release"
EXTRA_HELP="	release	Drop the display but keep the daemon running"