diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-02-11 07:29:38 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-02-11 07:29:38 (GMT) |
commit | 09b14aa48e621e4263c095769bbd2697893eef8d (patch) | |
tree | 540e7da12e13804e73bc93641f45fa5e26a35ef4 /abs/core-testing/splashy/splashy-functions | |
parent | 31b573e6bbe5a38097d3dbe1c45b6ddf09864dec (diff) | |
download | linhes_pkgbuild-09b14aa48e621e4263c095769bbd2697893eef8d.zip linhes_pkgbuild-09b14aa48e621e4263c095769bbd2697893eef8d.tar.gz linhes_pkgbuild-09b14aa48e621e4263c095769bbd2697893eef8d.tar.bz2 |
Needed for Splashy.
Diffstat (limited to 'abs/core-testing/splashy/splashy-functions')
-rw-r--r-- | abs/core-testing/splashy/splashy-functions | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/abs/core-testing/splashy/splashy-functions b/abs/core-testing/splashy/splashy-functions new file mode 100644 index 0000000..037cb27 --- /dev/null +++ b/abs/core-testing/splashy/splashy-functions @@ -0,0 +1,92 @@ +# +# splashy functions +# + +# functions: + +splashy_wait_till_ready() { debug_log "$0 ${FUNCNAME}" + local tries=50 + + /sbin/splashy_update "print" 2> /dev/null + + while [ $? -ne 0 ]; do + [ $tries -ne 0 ] || return 1 + ((tries--)) + sleep 0.1 + /sbin/splashy_update "print" 2> /dev/null + done + + debug_log "tries=$((50-$tries))" +} + +splashy_print() { debug_log "$0 ${FUNCNAME}" + /sbin/splashy_update "print ${1}" 2> /dev/null +} + +splashy_sysinit() { debug_log "$0 ${FUNCNAME}" + splashy_wait_till_ready +} + +splashy_multi() { debug_log "$0 ${FUNCNAME}" + return 0 +} + +splashy_shutdown() { debug_log "$0 ${FUNCNAME}" + clear > /dev/tty${1} + /sbin/splashy_chvt ${1} + + splashy shutdown 2> /dev/null + + splashy_wait_till_ready +} + +splashy_kill() { debug_log "$0 ${FUNCNAME}" + local tries=50 + while pidof splashy > /dev/null; do + [ $tries -ne 0 ] || return 1 + ((tries--)) + + kill -15 `pidof splashy` + sleep 0.2 + pidof splashy > /dev/null || break + kill -9 `pidof splashy` + sleep 0.2 + done + debug_log "tries=$((50-$tries))" +} + +splashy_exit() { debug_log "$0 ${FUNCNAME}" + pidof splashy > /dev/null || return 1 + + /usr/bin/setterm -cursor off > /dev/tty8 + + /sbin/splashy_update "progress 100" 2> /dev/null + sleep 0.3 + /sbin/splashy_update "exit" 2> /dev/null + sleep 0.3 + + splashy_kill + + if [ "$(fgconsole 2>/dev/null)" = "${1}" ]; then + clear > /dev/tty${1} || true + fi + + /usr/bin/setterm -cursor off > /dev/tty7 + + if [ -n "${2}" ]; then + if [ "$(fgconsole 2>/dev/null)" != "${2}" ]; then + /sbin/splashy_chvt ${2} || true + else + # fall back to tty1 + /sbin/splashy_chvt 1 || true + fi + fi +} + +splashy_progress() { debug_log "$0 ${FUNCNAME}" + PROGRESS=$(((${1}*100)/${2})) + /sbin/splashy_update "progress ${PROGRESS}" 2> /dev/null +} + +# End of file +# vim: set ts=2 noet: |