git: 87b48b8d60d4 - main - x11/sddm: make "user session" more resilient
Adriaan de Groot
adridg at FreeBSD.org
Sat Jul 17 22:22:03 UTC 2021
The branch main has been updated by adridg:
URL: https://cgit.FreeBSD.org/ports/commit/?id=87b48b8d60d42f77e3cea05610bbb5dde23ec896
commit 87b48b8d60d42f77e3cea05610bbb5dde23ec896
Author: Adriaan de Groot <adridg at FreeBSD.org>
AuthorDate: 2021-07-17 22:12:57 +0000
Commit: Adriaan de Groot <adridg at FreeBSD.org>
CommitDate: 2021-07-17 22:21:59 +0000
x11/sddm: make "user session" more resilient
It's possible to install SDDM with very little other X11 baggage,
like xterm. In such a minimal install situation, SDDM will still
come up and offer "User Session" -- and that session will fail,
because there's nothing to run.
Depend on xmessage, and then fall back to xinit's default script
and if **that** isn't there, show the user a message instead of
just sitting there with a black screen and an X cursor.
PR: 256648
Reported by: Graham Perrin
---
x11/sddm/Makefile | 7 +++++--
x11/sddm/files/xinit-session | 22 ++++++++++++++++------
x11/sddm/pkg-message | 7 +++++++
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/x11/sddm/Makefile b/x11/sddm/Makefile
index b13d0c4c0940..d3afc62e8501 100644
--- a/x11/sddm/Makefile
+++ b/x11/sddm/Makefile
@@ -1,7 +1,7 @@
PORTNAME= sddm
PORTVERSION= 0.19.0
DISTVERSIONPREFIX= v
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= x11
MAINTAINER= kde at FreeBSD.org
@@ -18,7 +18,8 @@ LICENSE_FILE_CC-BY-3.0= ${WRKSRC}/LICENSE.CC-BY-3.0
BUILD_DEPENDS= rst2man.py-${PYTHON_VER}:textproc/py-docutils@${PY_FLAVOR}
RUN_DEPENDS= dbus-run-session:devel/dbus \
- xauth:x11/xauth
+ xauth:x11/xauth \
+ xmessage:x11/xmessage
USES= cmake compiler:c++11-lang kde:5 pkgconfig python:build qt:5 xorg
USE_GITHUB= yes
@@ -53,5 +54,7 @@ post-install:
${MKDIR} ${STAGEDIR}${PREFIX}/share/xsessions
${INSTALL_DATA} ${WRKDIR}/xinitrc.desktop ${STAGEDIR}${PREFIX}/share/xsessions
${INSTALL_SCRIPT} ${FILESDIR}/xinit-session ${STAGEDIR}${PREFIX}/share/sddm/scripts
+ ${REINPLACE_CMD} -e 's#@@LOCALBASE@@#${LOCALBASE}#' ${STAGEDIR}${PREFIX}/share/sddm/scripts/xinit-session
+
.include <bsd.port.mk>
diff --git a/x11/sddm/files/xinit-session b/x11/sddm/files/xinit-session
index 804728c9ca53..d10125d73770 100644
--- a/x11/sddm/files/xinit-session
+++ b/x11/sddm/files/xinit-session
@@ -1,12 +1,22 @@
#!/bin/sh
#
# Runs the user's .xinitrc (at this point, .xsession has already
-# been sourced).
+# been sourced). If there is no .xinitrc, but xinit is installed,
+# then there is a default script. If neither is installed,
+# display a message.
RC="$HOME/.xinitrc"
+if [ ! -f "$RC" ] ; then
+ RC="@@LOCALBASE@@/etc/X11/xinit/xinitrc"
+ # But that one needs at least xterm to do something useful
+ if [ ! -x @@LOCALBASE@@/bin/xterm ] ; then
+ RC=""
+ fi
+fi
-test -f "$RC" || exit 1
-
-test -x "$RC" && exec "$RC"
-test -f "$RC" && exec /bin/sh "$RC"
-
+if [ -n "$RC" -a -f "$RC" ] ; then
+ test -x "$RC" && exec "$RC"
+ test -f "$RC" && exec /bin/sh "$RC"
+else
+ exec @@LOCALBASE@@/bin/xmessage -geometry +0+0 "There is no user-session or usable default with xterm"
+fi
diff --git a/x11/sddm/pkg-message b/x11/sddm/pkg-message
index bd1e209ceecf..2f3a3614efe5 100644
--- a/x11/sddm/pkg-message
+++ b/x11/sddm/pkg-message
@@ -10,4 +10,11 @@ following commands as root:
# rm -rf /usr/local/etc/sddm/home
EOM
}
+{ type: install
+ message: <<EOM
+SDDM lists a "user session" which requires an .xinitrc in the user's
+home directory, or as a fallback, xterm. It is advised to write an
+.xinitrc if you want to use the "user session" feature.
+EOM
+}
]
More information about the dev-commits-ports-all
mailing list