summaryrefslogtreecommitdiffstats
path: root/core/modules/pam-slx-plug/data
diff options
context:
space:
mode:
authorSimon Rettberg2020-08-11 14:49:18 +0200
committerSimon Rettberg2020-08-11 14:49:18 +0200
commitcda426345f5332337d5920bbe31d83f9cab31b37 (patch)
tree1868c67962d1d7368a4b34495649013a0f915641 /core/modules/pam-slx-plug/data
parent[dbus/dunst] Fix launching via dbus+systemd (diff)
downloadmltk-cda426345f5332337d5920bbe31d83f9cab31b37.tar.gz
mltk-cda426345f5332337d5920bbe31d83f9cab31b37.tar.xz
mltk-cda426345f5332337d5920bbe31d83f9cab31b37.zip
[pam-slx-plug] Kill pwdaemon, umount PERSISTENT on session end
Use user@.service to implement this, so multiple concurrent sessions of the same user are handled properly. Closes #3619
Diffstat (limited to 'core/modules/pam-slx-plug/data')
-rw-r--r--core/modules/pam-slx-plug/data/etc/systemd/system/user@.service.d/cleanup-umount.conf2
-rwxr-xr-xcore/modules/pam-slx-plug/data/opt/openslx/scripts/systemd-session_cleanup17
2 files changed, 19 insertions, 0 deletions
diff --git a/core/modules/pam-slx-plug/data/etc/systemd/system/user@.service.d/cleanup-umount.conf b/core/modules/pam-slx-plug/data/etc/systemd/system/user@.service.d/cleanup-umount.conf
new file mode 100644
index 00000000..d89b67bb
--- /dev/null
+++ b/core/modules/pam-slx-plug/data/etc/systemd/system/user@.service.d/cleanup-umount.conf
@@ -0,0 +1,2 @@
+[Service]
+ExecStopPost=!/opt/openslx/scripts/systemd-session_cleanup %I
diff --git a/core/modules/pam-slx-plug/data/opt/openslx/scripts/systemd-session_cleanup b/core/modules/pam-slx-plug/data/opt/openslx/scripts/systemd-session_cleanup
new file mode 100755
index 00000000..048b68b6
--- /dev/null
+++ b/core/modules/pam-slx-plug/data/opt/openslx/scripts/systemd-session_cleanup
@@ -0,0 +1,17 @@
+#!/bin/ash
+
+[ -z "$1" ] && exit 1
+[ "$1" = "0" ] && exit 0
+
+pkill -u "$1"
+sleep 1
+home="$( getent passwd "$1" | awk -F: '{print $6}' )"
+
+if [ -n "$home" ]; then
+ umount -l "$home/PERSISTENT"
+ umount -l "$home/.openslx"
+ # Leave $home/ in case user saved documents there and realized the mistake before rebooting
+fi
+
+exit 0
+