aboutsummaryrefslogtreecommitdiffstats
path: root/unix/ck-unlock-sessions.sh
blob: 05c4477e4c2cf278491a1038c91b8338e9d217ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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!"