summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/fbsplash/splash-functions-arch.sh
blob: 977ccefb32ea48036f258b5ec0780ff8e607157f (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
69
70
71
# ArchLinux specific splash functions #
# Author: Greg Helton <gt@fallendusk.org> #

splash_init() {
	splash_setup	
	splash_start
}

splash_exit() {
	splash_comm_send "exit"
	splash_cache_cleanup
}

splash_update_progress() {
	local PROGRESS
	PROGRESS=$(($1*65535/100))
	splash_comm_send "progress ${PROGRESS}"
	splash_comm_send "repaint"
}

var_save() {
for i in $@ ;
	do
		local var
		eval var=\$SPLASH_${i}
		echo "SPLASH_$i=$(echo ${var})" > ${spl_cachedir}/${i}
	done
}

var_load() {
for i in $@ ;
	do
		local var
		eval var=\$SPLASH_${i}
		if [[ -z "$(echo ${var})" && -f ${spl_cachedir}/${i} ]] ; then
			source ${spl_cachedir}/${i}
		fi
	done
}

save_boot_steps() {
	var_load STEP_NR
	echo $SPLASH_STEP_NR > /etc/conf.d/fbsplash.bootsteps
}

load_boot_steps() {
	BOOT_STEPS=$(cat /etc/conf.d/fbsplash.bootsteps)
	# Fail safe, so we don't divide by 0
	if [ $BOOT_STEPS = 0 ]; then
		BOOT_STEPS=1
	fi
	printf $BOOT_STEPS
}

save_shutdown_steps() {
	var_load SHUTDOWN_STEPS
	((SPLASH_SHUTDOWN_STEPS++))
	echo $SPLASH_SHUTDOWN_STEPS > /etc/conf.d/fbsplash.shutdownsteps
	var_save SHUTDOWN_STEPS
}

load_shutdown_steps() {
	SHUTDOWN_STEPS=$(cat /etc/conf.d/fbsplash.shutdownsteps)
	# Fail safe, so we don't divide by 0
	if [ $SHUTDOWN_STEPS = 0 ]; then
		SHUTDOWN_STEPS=1
	fi
	printf $SHUTDOWN_STEPS
}

# EOF #