File: postinst

package info (click to toggle)
gnome-remote-desktop 49.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,240 kB
  • sloc: ansic: 46,124; xml: 234; python: 168; sh: 99; makefile: 22
file content (61 lines) | stat: -rw-r--r-- 1,973 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# postinst script for gnome-remote-desktop
# inspired by polkitd.postinst
#
# This can be dropped if https://bugs.debian.org/1070473 gets fixed
#
# see: dh_installdeb(1)

set -e

case "$1" in
    configure)
        if ! getent passwd gnome-remote-desktop >/dev/null; then
            user_changed=yes
        else
            user_changed=
        fi

        # Intentionally not using dh_installsysusers: we need enough control
        # over sequencing to reload dbus-daemon after doing this, but before
        # restarting gnome-remote-desktop
        if command -v systemd-sysusers >/dev/null; then
            systemd-sysusers ${DPKG_ROOT:+--root="$DPKG_ROOT"} gnome-remote-desktop-sysusers.conf || true
        fi

        if command -v systemd-tmpfiles >/dev/null; then
            systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create gnome-remote-desktop-tmpfiles.conf || true
        fi

        # If the gnome-remote-desktop user was newly created,
        # the dbus-daemon might not know about that until reloaded.
        # dbus-broker's service has a dbus.service alias, so this will reload
        # either dbus-daemon or dbus-broker, whichever is used.
        if [ -z "${DPKG_ROOT-}" ] && [ -n "$user_changed" ]; then
            invoke-rc.d dbus reload || true
        fi

	# Disable the system service by default for users updating from a buggy version
	if dpkg --compare-versions "$2" lt-nl 48.1-1; then
		if deb-systemd-helper --quiet was-enabled 'gnome-remote-desktop.service'; then
			printf "Disable system unit that shouldn't have been auto enabled\n"
			deb-systemd-helper disable 'gnome-remote-desktop.service' >/dev/null || true
		fi
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0