updated on Wed Jan 25 12:16:47 UTC 2012
[aur-mirror.git] / plymouth-git / plymouth.functions
blob0612e57aab149b986acd434c59d527299faac2d4
2 if [[ -x /bin/plymouth && -x /sbin/plymouthd ]]; then
4         ply_client() { /bin/plymouth --ping && /bin/plymouth "$@"; }
5         ply_daemon() { /sbin/plymouthd "$@"; }
7         # save a function under a new name
8         save_function() {
9                 local ORIG=$(declare -f $1)
10                 eval "$2${ORIG#$1}"
11         }
13         save_function stat_busy std_stat_busy
14         save_function stat_fail std_stat_fail
16         # overwrite status functions
17         stat_busy() {
18                 ply_client --update="$1"
19                 ply_client message --text="$1"
20                 std_stat_busy  "$@"
21         }
23         stat_fail() {
24                 ply_client --quit
25                 std_stat_fail "$@"
26         }
28         # update after local filesystems are mounted
29         ply_sysinit_postmount() { ply_client --sysinit; }
30         add_hook sysinit_postmount ply_sysinit_postmount
32         # stop plymouth after rc.multi
33         ply_quit_boot() {
34                 ply_client quit --retain-splash
35         }
36         add_hook multi_end ply_quit_boot
38         # stop plymouth before shutdown
39         ply_quit_shutdown() {
40                 ply_quit_boot
41                 [[ $(ps h $(cat /tmp/plymouthd)) ]] && kill -9 $(cat /tmp/plymouthd)
42         }
43         add_hook shutdown_poweroff ply_quit_shutdown
45         # start plymouth at the beginning of rc.shutdown
46         ply_shutdown_start(){
47                 XPID=`pidof X`
48                 if [ "$XPID" ]; then
49                         if [ "`runlevel | cut -c 3`" != '5' ]; then
50                                 local DM
51                                 for DM in slim gdm kdm xdm entrance; do
52                                         ck_daemon "$DM" || stop_daemon "$DM"
53                                 done
54                         fi
55                         kill -9 $XPID &> /dev/null
56                 fi
57                 ply_daemon --mode=shutdown --pid-file=/tmp/plymouthd
58                 ply_client --show-splash
60                 # don't get killed by kill_all
61                 add_omit_pids `cat /tmp/plymouthd`
62         }
63         add_hook shutdown_start ply_shutdown_start
66 # vim: set ts=2 sw=2 ft=sh noet: