aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan de Groot <adridg@FreeBSD.org>2021-07-17 22:12:57 +0000
committerAdriaan de Groot <adridg@FreeBSD.org>2021-07-17 22:21:59 +0000
commit87b48b8d60d42f77e3cea05610bbb5dde23ec896 (patch)
treeb646ef6264082456be6a662e78f53e70e925bd2a
parent9410ef41aea53511b785e86dad115ab73b2397c9 (diff)
downloadports-87b48b8d60d42f77e3cea05610bbb5dde23ec896.tar.gz
ports-87b48b8d60d42f77e3cea05610bbb5dde23ec896.zip
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
-rw-r--r--x11/sddm/Makefile7
-rw-r--r--x11/sddm/files/xinit-session22
-rw-r--r--x11/sddm/pkg-message7
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@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
+}
]