Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] Devuan ASCII: startx to a new tty

4 views
Skip to first unread message

Dario Niedermann

unread,
Sep 13, 2018, 12:35:03 PM9/13/18
to
Submitted-by: da...@darioniedermann.it
Archive-name: devuan-startx-newtty.patch

The following patch for Devuan ASCII restores the correct `startx'
behaviour of allocating the first free tty for X.

With the bundled `startx' version, Xorg is launched in the same tty
where `startx' is invoked; which is wrong, inconvenient and messy.
To name but one downside: once you quit X, the tty is no longer owned
by your user, but by root.

The current broken behaviour originated at RedHat as a kludge
for systemd component logind, and has no place in a distribution
devoid of systemd. You can read about the birth of the kludge
by following the http link found in the patch.

========================================================================
---- Cut Here and feed the following to sh ----

#!/bin/sh
# This is devuan-startx-newtty.patch, a shell archive (produced by GNU sharutils 4.15.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the '#!/bin/sh' line above, then type 'sh FILE'.
#
lock_dir=_sh13814
# Made on 2018-09-13 17:51 CEST by <da...@darioniedermann.it>.
# Source directory was '/home/ndr'.
#
# Existing files will *not* be overwritten, unless '-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 3128 -rw------- devuan-startx-newtty.patch
#
if test "X$1" = "X-c"
then keep_file=''
else keep_file=true
fi
echo=echo
shar_tty=
shar_n=
shar_c='\n'
if test ! -d ${lock_dir} ; then :
else ${echo} "lock directory ${lock_dir} exists"
exit 1
fi
if mkdir ${lock_dir} ; then :
else ${echo} "failed to create ${lock_dir} lock directory"
exit 1
fi
# ============= devuan-startx-newtty.patch ==============
if test -n "${keep_file}" && test -f 'devuan-startx-newtty.patch'
then
${echo} "x - SKIPPING devuan-startx-newtty.patch (file already exists)"

else
${echo} "x - extracting devuan-startx-newtty.patch (text)"
sed 's/^X//' << 'SHAR_EOF' > 'devuan-startx-newtty.patch' &&
X-----BEGIN PGP SIGNED MESSAGE-----
XHash: SHA1
XNotDashEscaped: You need GnuPG to verify this message
X
Xdevuan-startx-newtty patch by <da...@darioniedermann.it> 12-Sep-2018
X
X=== How to apply this patch ===
X
X# cd / && patch -p1 < /path/to/devuan-startx-newtty.patch
X
XThere is no need to trim any text, before or within the patch itself:
Xthe `patch' program knows what to skip.
X
X
X=== Part 1 ===
X
XA conditional is added to `startx' to check for the presence of systemd.
XIf the conditional fails, the nested block will not be executed.
XOn Devuan, that amounts to removing the 5 lines now encased
Xin the conditional.
X
XThose lines were responsible for passing `xinit' (and in turn `Xorg')
Xa 'vt' option followed by the current tty number. We must avoid that,
Xif we want a new tty.
X
XThe added conditional was copied from another systemd-less distro
X(VoidLinux, possibly it got there from somewhere upstream).
XI also comment out a '-keeptty' option that was in the Devuan version
X(but those lines are no longer being executed anyway).
X
X
X--- /usr/bin/startx.orig 2015-10-19 03:54:32.000000000 +0200
X+++ /usr/bin/startx 2018-09-11 21:18:14.812510159 +0200
X@@ -104,10 +104,12 @@
X # When starting the defaultserver start X on the current tty to avoid
X # the startx session being seen as inactive:
X # "https://bugzilla.redhat.com/show_bug.cgi?id=806491"
X- tty=$(tty)
X- if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then
X- tty_num=$(echo "$tty" | grep -oE '[0-9]+$')
X- vtarg="vt$tty_num -keeptty"
X+ if [ -x /usr/lib/systemd/systemd -o -x /lib/systemd/systemd ]; then
X+ tty=$(tty)
X+ if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then
X+ tty_num=$(echo "$tty" | grep -oE '[0-9]+$')
X+ vtarg="vt$tty_num" # -keeptty"
X+ fi
X fi
X
X
X=== Part 2 ===
X
XThe Devuan 'Xwrapper.config' file wasn't setting the 'needs_root_rights'
Xvariable. So, the patched `startx' would lack permission to allocate
Xthe first available tty, and it would fail - except when issued by root.
X
X
X--- /etc/X11/Xwrapper.config.orig 2018-09-09 07:46:44.216064832 +0200
X+++ /etc/X11/Xwrapper.config 2018-09-11 22:38:43.086092849 +0200
X@@ -13,3 +13,4 @@
X # again, run the following command as root:
X # dpkg-reconfigure xserver-xorg-legacy
X allowed_users=console
X+needs_root_rights = yes
X-----BEGIN PGP SIGNATURE-----
X
XiQIcBAEBAgAGBQJbmO3DAAoJEPJFaEEGrTgGYZEP/iPkZ8VTXveSOvmgbFIxiL1m
Xp9oq0oKPlK+/rO0i6hheNPzylgnddvRNgpp0vrrnJPYFK9KCFBC1R4j3ePNJawPu
X8ysnDDwWtjxdg7t8rDtRH0JEwDY+FPv+EqBxTb65wULGpjwG302FpjXr7LmlJzJP
XPCPSO5flIjJ+RzCfmp2BK/sP2N498bcO+vQcKkv0bTAJ/sIsHHnbEnPxilKjeb1Q
XEwGZKBRTn61OTE7x+Jh0pzFoBeZaIsrCmu+BjwphQ3meOiCZq+PDFO5VgbhsrGLv
XtpP15awlXAQdR8GGxj6fAOfqlMJ59cwbHpwuI5CfPhIrrQDjMmUgW3X6ifxNqK9x
X7L5kcc8OeqYLFcd0u8IawxGEIiWmaO+M/WKTVsd+pqjGqPfWk6JvAcrMoFwMmjQG
XiWa7D0dO0xGJayuyBwBMo/hBxgeCAjDh0ij9hEC8QJ4WEOXfxIgDuGx6zxurAyst
XvcguMdNNfU+552Zc/58dq79+e3gG+5DY+fIXUAV0PvAH3FdrSAnUEpbNBS+bhJ3o
XIl8P3NnQDBxNzx8QxpUojMiinooFqDBAboM78Rio7qil+ZF5cyFZ2fP5fwRk9NOg
XjjLlnicyvFyT0oGb5WK/y5O0pagb3J2T31Apz+TaLzg/EdW51826kNGSCCw/B/+q
X+cj4iYqOcoJR/erfxCfo
X=xj6f
X-----END PGP SIGNATURE-----
SHAR_EOF
:
if test $? -ne 0
then ${echo} "restore of devuan-startx-newtty.patch failed"
fi
fi
if rm -fr ${lock_dir}
then ${echo} "x - removed lock directory ${lock_dir}."
else ${echo} "x - failed to remove lock directory ${lock_dir}."
exit 1
fi
exit 0

--
Dario Niedermann. Also on the Internet at:

gopher://darioniedermann.it/ <> https://www.darioniedermann.it/
0 new messages