Patch to enable reboot/shutdown from within the session

Alkis Georgopoulos <[email protected]> Fri, 04 Dec 2009 15:30:07 +0200
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
Currently the users are not able to reboot/shutdown the clients from
within the gnome/kde/etc session.

To make this possible, one way is to set an xprop from within the
session, which would later be picked up by LDM
    xprop -root -f LDM_LOGOUT_ACTION 8s -set LDM_LOGOUT_ACTION HALT

This could be invoked from e.g. a menu that the administrator sets, or
even from gnome-session itself, if we manage to push to our distros
really small patches like the following:
    https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/491940


In order for this xprop to be handled from the LDM side, the following
changes need to be done:

1) At the end of /usr/share/ldm/rc.d/X99-zzz-logout-action:
    $(xprop -root -notype LDM_LOGOUT_ACTION | sed -e 's/^LDM_LOGOUT_ACTION = //' -e 's/^"//' -e 's/"$//') > /tmp/ldm-logout-action

2) At the end of /usr/lib/ltsp/screen.d/ldm:
    case "$(cat /tmp/ldm-logout-action)" in
        REBOOT)
            reboot -fp
            ;;
        HALT)
            shutdown -fp
            ;;
    esac

I tried first to put this inside ldm.c, but I had problems with ghost
processes, so I put it after X closes.

Tested and working fine in my Ubuntu Karmic, now I'm able to
shutdown/reboot the clients directly from the gnome menus.
Please consider it for inclusion.


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net