| 1 |
#!/bin/sh |
| 2 |
# postinst script for gnome-remote-desktop |
| 3 |
# inspired by polkitd.postinst |
| 4 |
# |
| 5 |
# This can be dropped if https://bugs.debian.org/1070473 gets fixed |
| 6 |
# |
| 7 |
# see: dh_installdeb(1) |
| 8 |
|
| 9 |
set -e |
| 10 |
|
| 11 |
case "$1" in |
| 12 |
configure) |
| 13 |
if ! getent passwd gnome-remote-desktop >/dev/null; then |
| 14 |
user_changed=yes |
| 15 |
else |
| 16 |
user_changed= |
| 17 |
fi |
| 18 |
|
| 19 |
# Intentionally not using dh_installsysusers: we need enough control |
| 20 |
# over sequencing to reload dbus-daemon after doing this, but before |
| 21 |
# restarting gnome-remote-desktop |
| 22 |
if command -v systemd-sysusers >/dev/null; then |
| 23 |
systemd-sysusers ${DPKG_ROOT:+--root="$DPKG_ROOT"} gnome-remote-desktop-sysusers.conf || true |
| 24 |
fi |
| 25 |
|
| 26 |
if command -v systemd-tmpfiles >/dev/null; then |
| 27 |
systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create gnome-remote-desktop-tmpfiles.conf || true |
| 28 |
fi |
| 29 |
|
| 30 |
# If the gnome-remote-desktop user was newly created, |
| 31 |
# the dbus-daemon might not know about that until reloaded. |
| 32 |
# dbus-broker's service has a dbus.service alias, so this will reload |
| 33 |
# either dbus-daemon or dbus-broker, whichever is used. |
| 34 |
if [ -z "${DPKG_ROOT-}" ] && [ -n "$user_changed" ]; then |
| 35 |
invoke-rc.d dbus reload || true |
| 36 |
fi |
| 37 |
|
| 38 |
# Disable the system service by default for users updating from a buggy version |
| 39 |
if dpkg --compare-versions "$2" lt-nl 48.1-1; then |
| 40 |
if deb-systemd-helper --quiet was-enabled 'gnome-remote-desktop.service'; then |
| 41 |
printf "Disable system unit that shouldn't have been auto enabled\n" |
| 42 |
deb-systemd-helper disable 'gnome-remote-desktop.service' >/dev/null || true |
| 43 |
fi |
| 44 |
fi |
| 45 |
;; |
| 46 |
|
| 47 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 48 |
;; |
| 49 |
|
| 50 |
*) |
| 51 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 52 |
exit 1 |
| 53 |
;; |
| 54 |
esac |
| 55 |
|
| 56 |
# dh_installdeb will replace this with shell code automatically |
| 57 |
# generated by other debhelper scripts. |
| 58 |
|
| 59 |
#DEBHELPER# |
| 60 |
|
| 61 |
exit 0 |