CTKArch · Forums
You are not logged in. Please Register or Login.  |  Search
Posted: Feb 11, 2011 9:26:47 am
xunil
icon



I had some problems with shutdown and reboot not working after update. But now it works with Zenity script.
It doesn't need Hal running or Gdm.

It needs Zenity from pacman.
Name it exit.sh and make it executable, put it in user/bin and edit the menu.xml ad a line exit.sh
I hope it helps someone.



#!/bin/bash
# Multiple Exit script using Zenity for non GDM installs
# Requires zenity and an edit to sudoers to allow all users to use the shutdown command
# As follows:
#
# Open a terminal
# EDITOR=nano
# sudo visudo
# Scroll to bottom of file and add this: (not the #)
# ALL ALL=NOPASSWD:/sbin/shutdown
#
######## This part is the Exit Type picker  ##########

title="EXIT: What do you want to do ?"
exit_type=`zenity  --width="530" --height="220" --title="$title" --list --radiolist --column="Click Here"
    --column="Exit Type" --column="Description"
    TRUE "Logout" "Log Current User out and return to Login Screen"
    FALSE "Reboot" "Reboot the PC"
    FALSE "Shutdown" "Shutdown the PC"
    FALSE "Cancel" "Cancel the Exit"
    | sed 's/ max//g' `

echo "$exit_type chosen as the Exit Type!."

#user must select a target type (Check if they cancelled)
if [ ! "$exit_type" ]; then
    zenity --error --title="Error" --text="You must make a selection!"
    exit
fi

######### This part takes the selection and applies it!  #############

# Edit this first section if not using openbox! #
if [ "$exit_type" = "Logout" ]
then
        # Do logout here.
        openbox --exit && sleep 1 | zenity --progress --percentage=95 --title=Logout --auto-close --auto-kill --no-cancel --width=300

elif [ "$exit_type" = "Reboot" ]
then
        # Do Reboot here.
        sudo shutdown -r now | zenity --progress --percentage=95 --title=Reboot --auto-close --auto-kill --no-cancel --width=300

elif [ "$exit_type" = "Shutdown" ]
then
        # Do Shutdown here.
    sudo shutdown -h now | zenity --progress --percentage=95 --title=Shutdown --auto-close --auto-kill --no-cancel --width=300

else

#if [ "$exit_type" = "Cancel" ]
#then
        # Do Cancel here.
    sleep 1 | zenity --progress --percentage=95 --title=Cancelling Exit --auto-close --auto-kill --no-cancel --width=300
fi

Thanks to the developer of this script I couldn't find his name but here is his Blog.
bimma.me.uk/2011/01/01/zenity-exit-shutdown-script-for-openbox/
Posted: Feb 13, 2011 1:05:21 pm
Calimero
icon



It's just a fancy use of sudo. :)

In fact, the real problem is that the consolekit package of Arch i686 is broken.
See this topic: ctkarch.org/forum/viewtopic.php?id=2&t_id=2
Posted: Feb 14, 2011 8:26:19 am
Calimero
icon



Fix found!

Create /etc/autostartx containing (change user="arch" to your username):
BASH Code:
#!/bin/sh
#Runs an X session for the user defined here:
user="arch"
 
echo 'Starting X session for '"$user"
login -f "${user}" STARTX=1

Don't forget to chmod +x /etc/autostartx

Logged as your user, run:
BASH Code:
echo 'if [ "$STARTX" == "1" ];then
unset STARTX ; startx &>/dev/null
exit 0
fi'
>> ~/.bash_profile


And in /etc/inittab, change:

BASH Code:
x:5:once:/bin/su arch -l -c "/bin/bash --login -c startx &>/dev/null" &>/dev/null

to

BASH Code:
c4:5:respawn:/sbin/agetty -n -l /etc/autostartx 38400 tty4 linux


Enjoy!
Posted: Feb 14, 2011 10:25:02 am
xunil
icon



Good you found the solution  :)  .

[edit by calimero] please don't quote the message just behind.
Powered by myUPB v2.2.7  ·   Creative Commons License PHP Outburst