On 2016-07-02 Sat 11:21 AM |, Bob Beck wrote:
> On Saturday, 2 July 2016, Craig Skinner <skin...@britvault.co.uk> wrote:
> >
> > xmessage is now run as '_x11', shutdown as 'operator', and the status
> > items as 'nobody'. Only user _x11's xmessage windows are pkilled.
> >
> 
> Do not use nobody.
> 
> that is a very bad practice.  may as well call nobody NFS.
> 

Thanks Bob;- user 'nobody' nuked & replaced by 'operator'.

Anything else to get sorted?

--- /etc/X11/xdm/Xsetup_0       2016/06/28 14:20:18     1.1
+++ /etc/X11/xdm/Xsetup_0       2016/07/04 13:20:56
@@ -1,8 +1,51 @@
 #!/bin/sh
-# $OpenBSD: Xsetup_0,v 1.1 2016/06/28 13:20:18 craig Exp $
+# $OpenBSD: Xsetup_0,v 1.17 2016/07/04 12:23:59 craig Exp $
+
+# Convenience GUI button items:
+alias su_x11='su -s /bin/sh _x11 -c'
+alias su_optr='su -s /bin/sh operator -c'
+
+function _xdm_machine_shutdown
+{
+       su_x11 "xmessage -geometry +0+0 -buttons 'Shutdown:20,Reboot:21' ' 
Machine:'"
+       case $? in
+               20)
+                       su_optr "shutdown -hp now 'xdm login screen'"
+                       ;;
+               21)
+                       su_optr "shutdown -r now 'xdm login screen'"
+                       ;;
+       esac
+}
+
+function _xdm_machine_status
+{
+       while true
+       do
+               su_x11 "xmessage -geometry -0+0 -buttons 'Battery:30,Load:31' ' 
Status:'"
+               case $? in
+                       30)
+                               su_optr 'apm'
+                               ;;
+                       31)
+                               su_optr 'uptime'
+                               ;;
+                       # TODO:
+                       #32)
+                       #       su_optr 'some-wifi-status-thing'
+                       #       ;;
+                       *)
+                               break
+                               ;;
+               esac
+       done
+}
+
 if [ "$DISPLAY" = ":0" -o "$DISPLAY" = ":0.0" ]
 then
        xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed 
-exitOnFail
+       _xdm_machine_shutdown >/dev/console 2>&1 &
+       _xdm_machine_status >/dev/console 2>&1 &
 fi
 
 #sxpm OpenBSD.xpm &
--- /etc/X11/xdm/GiveConsole    2015/06/30 16:44:10     1.2
+++ /etc/X11/xdm/GiveConsole    2016/07/02 13:18:32
@@ -1,6 +1,11 @@
 #!/bin/sh
 # Assign ownership of the console to the invoking user
-# $OpenBSD: GiveConsole,v 1.2 2015/06/30 15:44:10 craig Exp $
+# $OpenBSD: GiveConsole,v 1.4 2016/07/02 12:24:40 craig Exp $
+#
+
+# Started in Xsetup_0
+pkill -U _x11 -x xmessage
+
 #
 # By convention, both xconsole and xterm -C check that the
 # console is owned by the invoking user and is readable before attaching

Reply via email to