aboutsummaryrefslogtreecommitdiffstats
path: root/unix/ck-unlock-sessions.sh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-02-07 18:36:00 +0800
committerAaron LI <aaronly.me@outlook.com>2017-02-07 18:36:00 +0800
commit66714445d637251e28e2a6283e88a80b838bf91f (patch)
tree8ff10fac6ac0906e3ac27d95da33e31246a1b992 /unix/ck-unlock-sessions.sh
parent137f0a2f4758071db2c3cb8c4c45f72fd541d98a (diff)
downloadatoolbox-66714445d637251e28e2a6283e88a80b838bf91f.tar.bz2
Add unix/ck-unlock-sessions.sh to unlock ConsoleKit sessions
This script works like systemd's `loginctl unlock-sessions`
Diffstat (limited to 'unix/ck-unlock-sessions.sh')
-rwxr-xr-xunix/ck-unlock-sessions.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/unix/ck-unlock-sessions.sh b/unix/ck-unlock-sessions.sh
new file mode 100755
index 0000000..05c4477
--- /dev/null
+++ b/unix/ck-unlock-sessions.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Unlock the user sessions when the screen locker failed/crashed
+# (e.g., during an upgrade).
+#
+# This is the solution for ConsoleKit (e.g., on Gentoo Linux).
+# As for the `systemd` case, simply run:
+# $ loginctl unlock-sessions
+#
+# NOTE:
+# Root privilege is required.
+#
+# Reference:
+# * KDE bugs: #360489
+# https://bugs.kde.org/show_bug.cgi?id=360489
+#
+# Aaron LI
+# 2017-02-07
+#
+
+for session in $(ck-list-sessions | grep '^Session' | tr -d ':'); do
+ echo "* Unlock ConsoleKit session: ${session} ..."
+ sudo dbus-send --system --print-reply \
+ --dest="org.freedesktop.ConsoleKit" \
+ /org/freedesktop/ConsoleKit/Session2 \
+ org.freedesktop.ConsoleKit.Session.Unlock
+done
+
+echo "Done! Unlocked all ConsoleKit sessions!"