030-wm.sh: switch to sudo to fix controlling tty issue with recent X.org
authorMichael Prokop <mika@grml.org>
Fri, 7 Apr 2017 14:37:05 +0000 (16:37 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 7 Apr 2017 14:37:05 +0000 (16:37 +0200)
X.org doesn't run as root anymore (unless using
xserver-xorg-legacy workaround). When invoking X.org via 'su -c
...' no controlling tty can be acquired, because of a change in
upstream's shadow release 4.1.5 (dating back to 2011-06-05).
Related to
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802769
We need read and write permissions on the TTY, so adjust the TTY
we're running on accordingly.

quickconfig/030-wm.sh

index cc3bd99..b9f460c 100644 (file)
@@ -74,7 +74,9 @@ wm_heading() {
 # print windowm manager loop {{{
 wm_menu() {
   if [ $AVAILABLE_WM_COUNT == 1 ]; then
-    run su grml -c "grml-x"
+    chgrp tty "$TTY"
+    chmod g+rw "$TTY"
+    run sudo -u grml grml-x
     return
   fi
   echo
@@ -88,7 +90,9 @@ wm_menu() {
   get_key INPUT
   case $INPUT in
     [${(k)available}])
-    run su grml -c "grml-x ${available[$INPUT]}"
+    chgrp tty "$TTY"
+    chmod g+rw "$TTY"
+    run sudo -u grml -c "grml-x ${available[$INPUT]}"
     ;;
   esac
 }