diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:00:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:00:48 +0000 |
commit | f542925b701989ba6eed7b08b5226d4021b9b85f (patch) | |
tree | 57e14731f21a6d663326d30b7b88736e9d51c420 /debian/systemd.postinst | |
parent | Adding upstream version 247.3. (diff) | |
download | systemd-f542925b701989ba6eed7b08b5226d4021b9b85f.tar.xz systemd-f542925b701989ba6eed7b08b5226d4021b9b85f.zip |
Adding debian version 247.3-7+deb11u4.debian/247.3-7+deb11u4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/systemd.postinst')
-rw-r--r-- | debian/systemd.postinst | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/debian/systemd.postinst b/debian/systemd.postinst new file mode 100644 index 0000000..d706588 --- /dev/null +++ b/debian/systemd.postinst @@ -0,0 +1,148 @@ +#!/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 + +# Enable getty and remote-fs.target by default on new installs +if [ -z "$2" ]; then + systemctl enable getty@tty1.service || true + systemctl enable remote-fs.target || true +fi + +# Enable systemd-pstore by default on new installs and upgrades, see #952767 +if dpkg --compare-versions "$2" lt "245.4-4~"; then + systemctl enable systemd-pstore.service || true +fi + +# Do a one-time migration of the local time setting +if [ -z "$2" ]; 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\n" > /etc/adjtime + fi +fi + +# Do a one-time migration of the TMPTIME setting +if [ -z "$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 +# Avoid clearing /tmp by shipping an empty /etc/tmpfiles.d/tmp.conf file +# which overrides /usr/lib/tmpfiles.d/tmp.conf. +# This file was automatically created because of local modifications in +# /etc/default/rcS where TMPTIME was set to infinite. +EOF + ;; + esac + fi +fi + +# Do a one-time migration of the RAMTMP setting +if [ -z "$2" ]; then + if [ -f /etc/default/rcS ]; then + . /etc/default/rcS + fi + if [ -f /etc/default/tmpfs ]; then + . /etc/default/tmpfs + fi + if [ "$RAMTMP" = "yes" ]; then + # systemctl enable will work even when systemd is not the active PID 1. + if [ ! -e /etc/systemd/system/tmp.mount ]; then + cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount + systemctl enable tmp.mount || true + fi + fi +fi + +# Create /etc/machine-id +systemd-machine-id-setup + +# Setup system users and groups +addgroup --quiet --system systemd-journal + +adduser --quiet --system --group --no-create-home --home /run/systemd \ + --gecos "systemd Network Management" systemd-network +adduser --quiet --system --group --no-create-home --home /run/systemd \ + --gecos "systemd Resolver" systemd-resolve + +# Enable persistent journal, in auto-mode, by default on new installs and upgrades +if dpkg --compare-versions "$2" lt "244.1-2~"; then + mkdir -p /var/log/journal + # Applying ACLs requires a mounted /proc and systemd-tmpfiles will fail if + # /proc is not available. Skip systemd-tmpfiles in this case. This should + # be fine, as this typically means we are inside a chroot and systemd is + # not currently active. The permissions will be applied on the next boot. + # https://github.com/systemd/systemd/issues/14745 + if mountpoint -q /proc; then + systemd-tmpfiles --create --prefix /var/log/journal + fi +fi + +# Initial update of the Message Catalogs database +_update_catalog + +if [ -n "$2" ]; then + _systemctl daemon-reexec || true + # don't restart logind; this can be done again once this gets implemented: + # https://github.com/systemd/systemd/issues/1163 + if dpkg --compare-versions "$2" lt-nl "246.2-2~"; then + # the socket configuration changed + _systemctl stop systemd-networkd.socket || true + fi + _systemctl try-restart systemd-networkd.service || true + _systemctl try-restart systemd-resolved.service || true + _systemctl try-restart systemd-journald.service || true +fi + +if dpkg --compare-versions "$2" lt-nl "235-3~"; then + # systemd-bus-proxyd got dropped before stretch, and never created any file + deluser --system systemd-bus-proxy || true +fi + +if dpkg --compare-versions "$2" lt-nl "236-1~"; then + # Clean up old /var/lib/systemd/clock on upgrade. + # The clock file used by systemd-timesyncd is now stored in + # StateDirectory=systemd/timesync. + rm -f /var/lib/systemd/clock +fi + +if dpkg --compare-versions "$2" lt-nl "239-12~"; then + # clean up bogus "nobody" group from #912525; ensure that it's a system group + if getent group nobody >/dev/null; then + delgroup --system nobody || true + fi +fi + +if dpkg --compare-versions "$2" lt-nl "245.4-4~"; then + # systemd-pstore.service is now enabled via sysinit.target + rm -f /etc/systemd/system/systemd-remount-fs.service.wants/systemd-pstore.service + rmdir --ignore-fail-on-non-empty /etc/systemd/system/systemd-remount-fs.service.wants 2> /dev/null || true +fi + +if dpkg --compare-versions "$2" lt-nl "245.4-5~"; then + # Clean up removed ondemand service + rm -f /etc/systemd/system/multi-user.target.wants/ondemand.service +fi + +#DEBHELPER# |