systemd/debian/systemd.postinst
Michael Biebl e14b697bbe Restart systemd-logind.service on upgrades
The CreateSession D-Bus API of systemd-logind changed between v44 and
v204 [1]. As result, newer versions of libpam-systemd fail to register a
new session if they talk to the old systemd-logind process.
Restarting systemd-logind.service when upgrading from v44 means we will
lose existing sessions, but as wheezy still has ConsoleKit as default,
this shouldn't matter that much.  Closes: #717403

[1] https://bugs.freedesktop.org/show_bug.cgi?id=67131
2013-07-25 00:46:10 +02:00

87 lines
2.3 KiB
Bash

#! /bin/sh
set -e
_systemctl() {
if [ -d /run/systemd/system ]; then
systemctl "$@"
fi
}
_update_catalog() {
journalctl --update-catalog || true
}
# Update Message Catalogs database in response to dpkg trigger
if [ "$1" = "triggered" ]; then
_update_catalog
exit 0
fi
# Cleanup state files from the auto-enabler which we used in wheezy
if dpkg --compare-versions "$2" lt "204-1"; then
rm -f /var/lib/systemd/enabled-units
rm -f /var/lib/systemd/run-debian-enable-units
rm -f /var/lib/systemd/*.symlinks
fi
if [ -n "$2" ]; then
_systemctl daemon-reexec || true
_systemctl try-restart systemd-journald.service || true
_systemctl try-restart systemd-logind.service || true
fi
# Do a one-time migration of the local time setting
if dpkg --compare-versions "$2" lt "33-1"; then
if [ -f /etc/default/rcS ]; then
. /etc/default/rcS
fi
if [ "$UTC" = "no" ] && [ ! -e /etc/adjtime ]; then
printf "0.0 0 0.0\n0\nLOCAL" > /etc/adjtime
fi
fi
# Do a one-time migration of the TMPTIME setting
if dpkg --compare-versions "$2" lt "36-2"; then
if [ -f /etc/default/rcS ]; then
. /etc/default/rcS
fi
if [ ! -e /etc/tmpfiles.d/tmp.conf ]; then
case "$TMPTIME" in
-*|infinite|infinity)
cat > /etc/tmpfiles.d/tmp.conf <<EOF
# Automatically migrated from TMPTIME in /etc/default/rcS
# Clear /var/tmp as in /usr/lib/tmpfiles.d/tmp.conf, but avoid clearing /tmp
d /var/tmp 1777 root root 30d
EOF
;;
esac
fi
fi
# Create /run/initctl → /dev/initctl compat symlink on upgrades
if [ -d /run/systemd/system ]; then
_systemctl restart systemd-initctl.socket || true
fi
if dpkg --compare-versions "$2" lt "40-1"; then
# /lib/init/rw has been replaced by /run, so try to remove it on upgrades
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=643699
_systemctl stop lib-init-rw.automount lib-init-rw.mount || true
if [ -d /lib/init/rw ]; then
rmdir --ignore-fail-on-non-empty /lib/init/rw || true
fi
# Create /run/initctl → /dev/initctl compat symlink on upgrades
if [ -d /run/systemd/system ]; then
ln -sf /dev/initctl /run/initctl
fi
fi
systemd-machine-id-setup
# initial update of the Message Catalogs database
_update_catalog
#DEBHELPER#