summaryrefslogtreecommitdiffstats
path: root/debian/postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:35:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:35:04 +0000
commit214f81cd9b7c94c10b633627034c21daaee837b2 (patch)
tree63f193ca9b27d4095af5ac000565ef928ddbb5f6 /debian/postinst
parentAdding upstream version 4.0. (diff)
downloadchrony-214f81cd9b7c94c10b633627034c21daaee837b2.tar.xz
chrony-214f81cd9b7c94c10b633627034c21daaee837b2.zip
Adding debian version 4.0-8+deb11u2.debian/4.0-8+deb11u2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/postinst')
-rw-r--r--debian/postinst73
1 files changed, 73 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..903add9
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,73 @@
+#!/bin/sh
+# postinst script for chrony
+#
+# see: dh_installdeb(1)
+
+set -e
+
+
+# targets: configure|abort-upgrade|abort-remove|abort-deconfigure
+
+case "$1" in
+ configure)
+
+ adduser --force-badname \
+ --system \
+ --group \
+ --quiet \
+ --gecos "Chrony daemon" \
+ --home /var/lib/chrony \
+ --no-create-home _chrony
+
+ if command -v ucf >/dev/null
+ then
+ ucf --three-way /usr/share/chrony/chrony.conf /etc/chrony/chrony.conf
+ ucf --three-way /usr/share/chrony/chrony.keys /etc/chrony/chrony.keys
+ if [ -x "$(command -v ucfr)" ]; then
+ ucfr chrony /etc/chrony/chrony.conf
+ ucfr chrony /etc/chrony/chrony.keys
+ fi
+ fi
+
+ # Change the user and group ownership of "/var/l{ib,og}/chrony" iif
+ # the chronyd's configuration does not contain the "user" directive.
+ # Also, update these directories' mode bits to 0750 to follow upstream.
+ if ! chronyd -p 2>/dev/null | grep -q "^user"; then
+ for d in /var/lib/chrony /var/log/chrony; do
+ if ! dpkg-statoverride --list "$d" >/dev/null; then
+ dpkg-statoverride --update --add _chrony _chrony 0750 "$d"
+ fi
+ done
+ fi
+
+ if [ -n "$2" ] && dpkg --compare-versions "$2" lt 4.0~pre4-1; then
+ # Migrate NTP sources obtained from DHCP to /run/chrony-dhcp
+ mkdir -p /run/chrony-dhcp
+ for file in $(find /var/lib/dhcp/ -type f -name "chrony.servers.*"); do
+ sed 's/.*/server &/' < "$file" > /run/chrony-dhcp/"${file##*servers.}.sources"
+ done
+
+ # Remove the staled PID file resulting from migrating its path from
+ # /run to /run/chrony/. Overriding dh_installinit and
+ # dh_systemd_start to use the --no-restart-after-upgrade option
+ # was a possibility but chronyd would have been down even longer
+ # during the upgrade.
+ rm -f /run/chronyd.pid
+ 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