summaryrefslogblamecommitdiffstats
path: root/bin/Xshutdown.sh
blob: f97350d1a807cab81e4bc8508c20b9cc2d9934cc (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                                
                                    














                                                                                              
#!/bin/sh
# export Display for GUI
export DISPLAY=":0.0"

# Use as shutdown
SHUTDOWN=/sbin/shutdown

case "$1" in
    shutdown)
        Xdialog --title Shutdown --center --beep --yesno "Really shutdown the system?" 0 0 \
        && (sync ; exec ${SHUTDOWN} -h now)
    ;;
    reboot)
        Xdialog --title Reboot --center --beep --yesno "Do you want to reboot the system?" 0 0 \
        && (sync ; exec ${SHUTDOWN} -r now)
    ;;
    standby)
        Xdialog -title Standby --center --beep --yesno "Do you want to suspend to ram?" 0 0 \
        && (sync ; exec pm-suspend )
    ;;
    ask)
        CHOICE=$(Xdialog --stdout --title 'Choose!' --menubox 'Choose your destiny!' 10 50 3 \
            standby "Suspend to ram." \
            shutdown "Shutdown your system." \
            reboot " Reboot this system.")
        [ -z "$CHOICE" ] && exit 1
        exec $0 $CHOICE
    ;;
    *)  
		echo $1
        echo 1>&2 "$0 (shutdown|reboot|standby|ask)"
        exit 1
    ;;
esac