updated on Wed Jan 11 00:07:16 UTC 2012
[aur-mirror.git] / splashy / splashy-functions
blob037cb278a561870e843d5ec978e9fdb8087a8c4a
2 # splashy functions
5 # functions:
7 splashy_wait_till_ready() { debug_log "$0 ${FUNCNAME}"
8         local tries=50
10         /sbin/splashy_update "print" 2> /dev/null
12         while [ $? -ne 0 ]; do
13                 [ $tries -ne 0 ] || return 1
14                 ((tries--))
15                 sleep 0.1
16                 /sbin/splashy_update "print" 2> /dev/null
17         done
19         debug_log "tries=$((50-$tries))"
22 splashy_print() { debug_log "$0 ${FUNCNAME}"
23         /sbin/splashy_update "print ${1}" 2> /dev/null
26 splashy_sysinit() { debug_log "$0 ${FUNCNAME}"
27         splashy_wait_till_ready
30 splashy_multi() { debug_log "$0 ${FUNCNAME}"
31         return 0
34 splashy_shutdown() { debug_log "$0 ${FUNCNAME}"
35         clear > /dev/tty${1}
36         /sbin/splashy_chvt ${1}
38         splashy shutdown 2> /dev/null
40         splashy_wait_till_ready
43 splashy_kill() { debug_log "$0 ${FUNCNAME}"
44         local tries=50
45         while pidof splashy > /dev/null; do
46                 [ $tries -ne 0 ] || return 1
47                 ((tries--))
49                 kill -15 `pidof splashy`
50                 sleep 0.2
51                 pidof splashy > /dev/null || break
52                 kill -9 `pidof splashy`
53                 sleep 0.2
54         done
55         debug_log "tries=$((50-$tries))"
58 splashy_exit() { debug_log "$0 ${FUNCNAME}"
59         pidof splashy > /dev/null || return 1
61         /usr/bin/setterm -cursor off > /dev/tty8
62         
63         /sbin/splashy_update "progress 100" 2> /dev/null
64         sleep 0.3
65         /sbin/splashy_update "exit" 2> /dev/null
66         sleep 0.3
68         splashy_kill
70         if [ "$(fgconsole 2>/dev/null)" = "${1}" ]; then
71                 clear > /dev/tty${1} || true
72         fi
74         /usr/bin/setterm -cursor off > /dev/tty7
76         if [ -n "${2}" ]; then
77                 if [ "$(fgconsole 2>/dev/null)" != "${2}" ]; then 
78                         /sbin/splashy_chvt ${2} || true
79                 else
80                         # fall back to tty1
81                         /sbin/splashy_chvt 1 || true
82                 fi
83         fi
86 splashy_progress() { debug_log "$0 ${FUNCNAME}"
87         PROGRESS=$(((${1}*100)/${2}))
88         /sbin/splashy_update "progress ${PROGRESS}" 2> /dev/null
91 # End of file
92 # vim: set ts=2 noet: