This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

plymouth.functions-20110712

By: a guest on Aug 14th, 2011  |  syntax: Bash  |  size: 1.45 KB  |  views: 171  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ply_client() {
  2.         [ -x /bin/plymouth ] && /bin/plymouth "$@"
  3. }
  4.  
  5. ply_daemon() {
  6.         [ -x /sbin/plymouthd ] && /sbin/plymouthd "$@"
  7. }
  8.  
  9. stat_busy() {
  10.         case "$1" in
  11.                 "Mounting Local Filesystems")
  12.                         ply_client --newroot=/
  13.                 ;;
  14.                 "Activating Swap")
  15.                         ply_client --sysinit
  16.                 ;;
  17.         esac
  18.        
  19.         ply_client --update="$1"
  20.         ply_client message --text="$1"
  21.        
  22.         printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
  23.         printf "${SAVE_POSITION}"
  24.         deltext
  25.         printf "   ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} "
  26. }
  27.  
  28. stat_fail() {
  29.         ply_client --quit
  30.        
  31.         deltext
  32.         printf "   ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n"
  33. }
  34.  
  35. ply_end(){
  36. if [ "$0" == "/etc/rc.shutdown" ]; then
  37.         XPID=`pidof X`
  38.         if [ "$XPID" ]; then
  39.                 RUNLEVEL=`runlevel`
  40.                         if [ "${RUNLEVEL:2:4}" != '5' ]; then
  41.                                 [ -e /var/run/daemons/slim ] && /etc/rc.d/slim stop
  42.                                 [ -e /var/run/daemons/gdm ] && /etc/rc.d/gdm stop
  43.                                 [ -e /var/run/daemons/kdm ] && /etc/rc.d/kdm stop
  44.                                 [ -e /var/run/daemons/xdm ] && /etc/rc.d/xdm stop
  45.                                 [ -e /var/run/daemons/entrance ] && /etc/rc.d/entrance stop
  46.                         fi
  47.                 kill -9 $XPID &> /dev/null
  48.         fi
  49.  
  50.         ply_daemon --mode=shutdown --pid-file=/tmp/plymouthd
  51.         ply_client --show-splash
  52.  
  53.         while [[ ( $(ps h $(cat /tmp/plymouthd)) ) && ( $ply_wait -lt 5 ) ]]; do
  54.                 ply_wait=$(( $ply_wait + 1 ))
  55.                 sleep 1
  56.         done
  57.  
  58.         [[ $(ps h $(cat /tmp/plymouthd)) ]] && kill -9 $(cat /tmp/plymouthd)
  59.  
  60. fi
  61.  
  62.         ply_client quit --retain-splash
  63.  
  64. }
  65. add_hook multi_end ply_end
clone this paste RAW Paste Data