This file is indexed.

postinst is in sddm 0.17.0-1ubuntu7.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

THIS_PACKAGE=sddm
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager

# creating sddm group if he isn't already there
if ! getent group sddm >/dev/null; then
    addgroup --system sddm
fi

# creating sddm user if he isn't already there
if ! getent passwd sddm >/dev/null; then
    adduser --system --ingroup sddm --home /var/lib/sddm sddm
    usermod -c "Simple Desktop Display Manager" sddm
    usermod -d "/var/lib/sddm"                  sddm
    usermod -g "sddm"                           sddm
    usermod -s "/bin/false"                     sddm
fi

if [ ! -e /var/lib/sddm ]; then
    # If sddm was purged while running, the home dir gets removed but the user
    # remains (as deluser refuses to delete a user that's in use).
    mkdir -p /var/lib/sddm
fi

if [ -d /var/lib/sddm ]; then
    chown -R sddm:sddm /var/lib/sddm
    chmod 0750 /var/lib/sddm
fi

# debconf is not a registry, so we only fiddle with the default file if it
# does not exist
if ! [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
  DEFAULT_DISPLAY_MANAGER=
  if db_get shared/default-x-display-manager; then
    DEFAULT_DISPLAY_MANAGER="$RET"
  fi
  if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
    DAEMON_NAME=
    if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
      DAEMON_NAME="$RET"
    fi
    if [ -z "$DAEMON_NAME" ]; then
      # if we were unable to determine the name of the selected daemon (for
      # instance, if the selected default display manager doesn't provide a
      # daemon_name question), guess
      DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
    fi
    if [ -n "$DAEMON_NAME" ]; then
      echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE"
    fi
  fi
fi

# remove the displaced old default display manager file if it exists
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
    rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
fi

# debconf hangs if sddm gets started below without this
db_stop || true

if [ "$1" = "configure" ]; then
    invoke-rc.d dbus reload || true
fi

DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
# set default-display-manager systemd service link according to our config
if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
    if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
        SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
        if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = /dev/null ]; then
            echo "Display manager service is masked" >&2
        elif [ -e "$SERVICE" ]; then
            ln -sf "$SERVICE" "$DEFAULT_SERVICE"
        else
            echo "ERROR: $SERVICE is the selected default display manager but does not exist" >&2
        fi
    fi
fi

# update-rc.d levels
S=30
K=01

if [ -x /etc/init.d/sddm ]; then
    update-rc.d sddm defaults $S $K >/dev/null 2>&1
fi

touch /var/log/sddm.log
chown sddm:sddm /var/log/sddm.log



exit 0