summarylogtreecommitdiffstats
path: root/fbsplash.initcpio_hook
blob: 2ace3e8bf9f751908fc5f002a33892ab8e16c47a (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
run_hook ()
{
	# avoid exporting configuration
	(
		SPLASH_INIT_MESSAGE="Initializing the kernel"
		# Get configuration and functions (faking sysinit for config file hacks)
		PREVLEVEL=N; RUNLEVEL=S
		. /usr/bin/splash-functions.sh
		unset PREVLEVEL RUNLEVEL

		[ "${SPLASH_MODE_REQ}" = "silent" ] || exit 0

		# Start the daemon here if possible
		# to show animations early and gain some bootup speed
		if [ -x "$spl_daemon" ]; then
			msg "Starting Fbsplash Daemon"
			set -e
			# Mount the cache within /run to get it moved to the new root
			mkdir /run/.splash-cache
			( spl_cachedir=/run/.splash-cache; splash_cache_prep )
			# Take over any existing cache content
			mkdir -p $spl_cachedir
			parent=$( dirname $spl_cachedir )
			mv $spl_cachedir $parent/.splash-cache
			cp -a $parent/.splash-cache /run/
			# Symlink for starting the daemon
			ln -s /run/.splash-cache $spl_cachedir
			# Wait for any fbcondecor fadein - may take very long on some broken systems
			i=0
			while [ -n "$( pidof fbcondecor_helper )" ]; do
				if [ $i -ge 50 ]; then
					err "timeout on waiting for fbcondecor_helper to die!"
					exit 1
				fi
				sleep .1
				i=$(( i + 1 ))
			done
			# Actually start the daemon
			cd /run/.splash-cache
			set +e
			SPLASH_BOOT_MESSAGE="${SPLASH_INIT_MESSAGE}"
			splash_start && sleep .1 # allow the daemon to open the event dev
			exit
		fi

		# Start the fbcondecor helper if not already done by fbcondecor kernel
		if ! fbcondecor_supported; then
			BOOT_MSG="${SPLASH_INIT_MESSAGE}" \
				/usr/bin/fbcondecor_helper 2 init 0 0 $SPLASH_THEME
		fi
	)
}