summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-splash/scripts/slx-splash.sh
blob: 7381997be4b3a90ff5c90f8bdbb0de75fc28721f (plain) (blame)
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
#!/usr/bin/env bash

show_splash() {
	if [ -e "/etc/splash.ppm.gz" ]; then
		systemd-preserve-process-marker /bin/busybox fbsplash -x -b -s "/etc/splash.ppm.gz" &
	elif [ -e "/etc/splash.ppm" ]; then
		systemd-preserve-process-marker /bin/busybox fbsplash -x -b -s "/etc/splash.ppm" &
	else
		echo "Splash screen requested, but not found in initramfs..."
	fi
}

init_drm() {
	# taken from dracut's plymouth module
	# first trigger graphics subsystem
	udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
	# first trigger graphics and tty subsystem
	udevadm trigger --action=add \
  	--subsystem-match=graphics \
		--subsystem-match=drm \
		--subsystem-match=tty \
		--subsystem-match=acpi \
		>/dev/null 2>&1

	udevadm settle --timeout=180 2>&1
}

if grep -wqE 'splash' /proc/cmdline; then
	# first init graphics
	init_drm
	# disable non-critical kernel messages
	echo "1 1 0 1" > /proc/sys/kernel/printk
	# disable systemd's status message on console
	# See: https://www.freedesktop.org/software/systemd/man/systemd.html#Signals
	kill -55 1
	# clear console
	busybox clear
	# disable cursor
	echo -e "\033[?25l" > /dev/console
	# finally:
	show_splash
fi

true