updated on Wed Jan 11 00:07:16 UTC 2012
[aur-mirror.git] / pm-bust / pm-bust
blob89cfbf33da1517427a3a342b7fcbce5a0b1db683
1 #!/bin/sh
3 TOUCHFILE=/var/run/pm-bust
4 QUESTION="Kernel update detected. Should I shutdown instead?"
6 export DISPLAY=:0
8 question() {
9 if [ -f /usr/bin/zenity ]; then
10 zenity --question --text "$QUESTION"
11 return "$?"
12 elif [ -f /usr/bin/Xdialog ]; then
13 Xdialog --yesno "$QUESTION" 200x90
14 return "$?"
15 else
16 echo "Install zenity or xdialog for GUI"
20 if [ -f $TOUCHFILE ]; then
21 if [ $(find /var/cache/pacman/ -name 'kernel26*' -newer $TOUCHFILE | wc -l) -gt 0 ]; then
22 if [ "$1" == "-gui" ]; then
24 question
26 if [ "$?" -eq 0 ]; then
27 shutdown="y"
28 else
29 shutdown="n"
31 else
32 echo "Kernel update detected. Should I shutdown instead? [y/N]"
33 read shutdown
36 if [ "$shutdown" == "y" ]; then
37 halt
40 exit 0
44 touch $TOUCHFILE
46 pm-hibernate