Re: Patch to enable reboot/shutdown from within the session

Gideon Romm <[email protected]> Fri, 04 Dec 2009 09:13:39 -0500
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
Alkis,

Rather than edit the LDM scren script, which I believe should never be
done at this point, I would rather we do this:

Create an "Init" script in the ldm/rc.d directory that does what you
propose.  Something like:

/usr/share/ldm/rc.d/I00-haltreboot :

case "$(cat /tmp/ldm-logout-action)" in
        REBOOT)
            exec reboot -fp
            ;;
        HALT)
            exec shutdown -fp
            ;;
esac

-Gadi

On Fri, 2009-12-04 at 15:30 +0200, Alkis Georgopoulos wrote:
> 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
-- 
--------------------------------------------------------
Gideon Romm | Proud LTSP Developer
[email protected]

Pay It Forward!  
Intel Atom 1.6GHz, 512MB RAM + Symbiont Boot Stick = $275
10% of order goes to school or open source project of your choice!

Buy yourself a lab or office and use your donation to set up a school,
pay for a desperately needed feature added to a software package,
or sponsor part of LTSP's annual developer's conference LTSP-by-the-sea!

Check out:  http://www.symbio-technologies.com/payitforward 


------------------------------------------------------------------------------
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