File: greeter

package info (click to toggle)
gdm3 49.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,060 kB
  • sloc: ansic: 31,633; sh: 1,633; xml: 539; makefile: 72
file content (54 lines) | stat: -rwxr-xr-x 1,182 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

DBUS_LOG="${AUTOPKGTEST_ARTIFACTS}/dbus-log"
JOURNAL_LOG="${AUTOPKGTEST_ARTIFACTS}/journal"
GDM_CFG_FILE=/etc/gdm3/daemon.conf
if dpkg-vendor --is Ubuntu; then
    GDM_CFG_FILE=/etc/gdm3/custom.conf
fi

trap log EXIT

# shellcheck disable=SC2317
log() {
    journalctl -b > "$JOURNAL_LOG"
}

count_calls() {
    method="$1"
    awk "\$1 == \"mc\" && \$8 == \"$method\"" < "$DBUS_LOG" | wc -l
}

check() {
    if [ "$(count_calls RegisterDisplay)" -ne 1 ]; then
        return 1
    fi
    if [ "$(count_calls RegisterSession)" -ne 1 ]; then
        return 1
    fi
    if [ "$(count_calls OpenSession)" -ne 1 ]; then
        return 1
    fi
    return 0
}

python3 -c "from gi.repository import GLib; \
cfg = GLib.KeyFile(); \
cfg.load_from_file('$GDM_CFG_FILE', GLib.KeyFileFlags.KEEP_COMMENTS); \
cfg.set_string('debug', 'Enable', 'true'); \
cfg.save_to_file('$GDM_CFG_FILE')"

dbus-monitor --system --profile interface=org.gnome.DisplayManager.Manager | tee "$DBUS_LOG" &
systemctl start gdm3

TIMEOUT=120
SECONDS=0
while [ $SECONDS -lt $TIMEOUT ]; do
    sleep 1
    if check; then
        exit 0
    fi
done

echo "Timed out waiting for greeter to display"
exit 1