summaryrefslogtreecommitdiffstats
path: root/abs/core/fbsplash/fbsplash.inithooks
blob: c396b92cd2b9075d2e4a2e02eaae2e0405c1f039 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# fbsplash function.d script #
# Author: Greg Helton <gt@fallendusk.org> #

# Who is calling? #
CALLER=$0

# splash stuff #
. /etc/conf.d/fbsplash.conf
. /sbin/splash-functions.sh

# Redefine the stat functions #
stat_bkgd() {
	printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
	deltext
	printf "   ${C_OTHER}[${C_BKGD}BKGD${C_OTHER}]${C_CLEAR} "
}

stat_busy() {
	printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
	printf "${SAVE_POSITION}"
 	deltext
	printf "   ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} "
	# This checks to see if we just brought up the lo interface in rc.sysinit #
	# if so, start the progress bar #
	if [ "${1}" == 'Bringing up loopback interface' ]; then
		splash rc_init
	fi
        # Load variables #
        var_load STEP_NR MAX_STEPS RC_MULTI RC_SYSINIT RC_SHUTDOWN
        # Only update the splash progress if we're in sysinit, multi, or shutdown. #
        if [[ "${SPLASH_RC_MULTI}" == "1" || "${SPLASH_RC_SYSINIT}" == "1" || "${SPLASH_RC_SHUTDOWN}" == "1" ]]; then
                ((SPLASH_STEP_NR++))
                SPLASH_PROGRESS=$((100*${SPLASH_STEP_NR}/${SPLASH_MAX_STEPS}))
                SPLASH_CURRENT_PROGRESS=${SPLASH_PROGRESS}
                splash_update_progress ${SPLASH_PROGRESS}
                var_save STEP_NR CURRENT_PROGRESS
        fi
	if [ "${SPLASH_RC_SHUTDOWN}" == "1" ]; then
		save_shutdown_steps
	fi

}

stat_done() {
	deltext
	printf "   ${C_OTHER}[${C_DONE}DONE${C_OTHER}]${C_CLEAR} \n"
}

stat_fail() {
	deltext
	printf "   ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n"
	splash_verbose
}

start_daemon() {
	/etc/rc.d/$1 start
}

# rc.sysinit #
if [ "$CALLER" == '/etc/rc.sysinit' ]; then
#	echo "fbsplash: Setting up splash..."
	splash_cache_prep
	SPLASH_MAX_STEPS=$(load_boot_steps)
	SPLASH_STEP_NR=0
	SPLASH_RC_MULTI=0
	SPLASH_RC_SYSINIT=1
	SPLASH_RC_SHUTDOWN=0
	var_save MAX_STEPS STEP_NR RC_MULTI RC_SYSINIT RC_SHUTDOWN
fi

# rc.multi #
if [ "$CALLER" == '/etc/rc.multi' ]; then
	SPLASH_RC_MULTI=1
	SPLASH_RC_SYSINIT=0
	var_save RC_MULTI RC_SYSINIT
fi

# rc.shutdown #
if [ "$CALLER" == '/etc/rc.shutdown' ]; then
#	echo "fbsplash: Setting up splash..."
	splash_cache_prep
	SPLASH_MAX_STEPS=$(load_shutdown_steps)
	SPLASH_SHUTDOWN_STEPS=1
	SPLASH_STEP_NR=0
	SPLASH_RC_MULTI=0
	SPLASH_RC_SYSINIT=0
	SPLASH_RC_SHUTDOWN=1
	var_save MAX_STEPS STEP_NR RC_MULTI RC_SYSINIT RC_SHUTDOWN DAEMON_STEPS
	splash rc_init
fi