summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-splash/module-setup.sh
blob: c5447adcd24f3e87256f012581bb664fee24d8f1 (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
#!/usr/bin/env bash
check() {
	# Tell dracut that this module should only be included if it is required
	# explicitly.
	return 255
}
depends() {
	echo slx-drm busybox
}
slx_execpost() {
	local _conf="/tmp/dracut-execpost-$RANDOM"
	local _script="/usr/local/slx-scripts/${1##*/}"
	inst_simple "${moddir}/scripts/${1}" "${_script}" || exit 10
	cat > "$_conf" <<-EXECPOST
[Service]
ExecStartPost=-${_script}
	EXECPOST
	inst_simple "$_conf" "/etc/systemd/system/${2}.d/${1##*/}.conf" || exit 10
	unlink "$_conf"
}
install() {
	mkdir -p "${initdir}/opt/openslx"
	cp -r "${moddir}/data/icons" "${initdir}/opt/openslx" || exit 1
	cp "${moddir}/data/splash.ppm" "${initdir}/etc/splash.ppm" || exit 1
	cp "${moddir}/scripts/splashtool" "${initdir}/usr/local/bin/splashtool" || exit 1

	slx_service "s3-splash-init" "Initialize bootsplash" \
		--wafter "dracut-pre-trigger.service"
	# Copy splashtool and icons to stage4, add service drop-in to reset console
	slx_service "s3-splash-stage4" "Copy splashtool and icons to stage 4" \
		--wafter "s3-copy-openslx-config.service" \
		--wafter "initrd-root-fs.target"

	# Change boot splash depending on boot mode = exam
	inst_hook pre-pivot 00 "${moddir}/scripts/slx-splash-exam.sh"

	# Done in stage 4 by setup-partitions
	#inst_hook pre-mount 00 "${moddir}/scripts/slx-splash-icon-hdd.sh"
	slx_execpost "slx-splash-icon-config.sh" "s3-fetch-config.service"
	slx_execpost "slx-splash-icon-rootfs.sh" "s3-mount-root.service"
	slx_execpost "slx-splash-icon-puzzle.sh" "s3-setup-addons.service"
	# NOTE: network related stuff is in integrated in slx-network
}