D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
lib
/
dpkg
/
info
/
Filename :
chrony.postinst
back
Copy
#!/bin/sh # postinst script for chrony # # see: dh_installdeb(1) . /usr/share/debconf/confmodule set -e # targets: configure|abort-upgrade|abort-remove|abort-deconfigure ucf_managed_sources="true" case "$1" in configure|reconfigure) ubuntu_ntp_pools_sources_filepath="/etc/chrony/sources.d/ubuntu-ntp-pools.sources" packaged_ubuntu_ntp_pools_sources_filepath="/usr/share/chrony/ubuntu-ntp-pools.sources" db_get chrony/configure_ubuntu_pools_in_sourcesd ucf_managed_sources="${RET}" if command -v ucf >/dev/null then ucf --debconf-ok --three-way /usr/share/chrony/chrony.conf /etc/chrony/chrony.conf ucf --debconf-ok --three-way /usr/share/chrony/chrony.keys /etc/chrony/chrony.keys if [ "${ucf_managed_sources}" = "true" ]; then ucf --debconf-ok --three-way "${packaged_ubuntu_ntp_pools_sources_filepath}" "${ubuntu_ntp_pools_sources_filepath}" else # If this was under ucf before, purge it. # If it wasn't under ucf before, this does not fail ucf --debconf-ok --purge "${ubuntu_ntp_pools_sources_filepath}" rm -f "${ubuntu_ntp_pools_sources_filepath}" fi if [ -x "$(command -v ucfr)" ]; then ucfr chrony /etc/chrony/chrony.conf ucfr chrony /etc/chrony/chrony.keys if [ "${ucf_managed_sources}" = "true" ]; then ucfr chrony "${ubuntu_ntp_pools_sources_filepath}" else # If this was under ucf before, purge it. # If it wasn't under ucf before, this does not fail ucfr --purge chrony "${ubuntu_ntp_pools_sources_filepath}" fi fi fi # Allocate the _chrony system user and group before running # the dpkg-statoverride commands below to prevent failure when chrony # is newly installed. systemd-sysusers ${DPKG_ROOT:+--root="$DPKG_ROOT"} chrony.conf # Change the user and group ownership of "/var/l{ib,og}/chrony" iif # chronyd's configuration does not contain the "user" directive. # Also, update these directories' mode bits to 0750 to follow upstream. # # We must also ensure that chronyd can read /etc/chrony/chrony.keys # after dropping root privileges. if ! chronyd -p | grep -q "^user"; then for d in /var/lib/chrony /var/log/chrony /etc/chrony/chrony.keys; do if ! dpkg-statoverride --list "$d" >/dev/null; then if [ "$d" = "/etc/chrony/chrony.keys" ]; then dpkg-statoverride --update --add root _chrony 0640 "$d" else dpkg-statoverride --update --add _chrony _chrony 0750 "$d" fi fi done 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. # Automatically added by dh_apparmor/5.0.0~alpha1-0ubuntu11 if [ "$1" = "configure" ]; then APP_PROFILE="/etc/apparmor.d/usr.sbin.chronyd" if [ -f "$APP_PROFILE" ]; then # Add the local/ include LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.sbin.chronyd" test -e "$LOCAL_APP_PROFILE" || { mkdir -p `dirname "$LOCAL_APP_PROFILE"` install --mode 644 /dev/null "$LOCAL_APP_PROFILE" } # Reload the profile, including any abstraction updates if aa-enabled --quiet 2>/dev/null; then apparmor_parser -r -T -W "$APP_PROFILE" || true fi fi fi # End automatically added section # Automatically added by dh_installsysusers/13.28ubuntu1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then systemd-sysusers ${DPKG_ROOT:+--root="$DPKG_ROOT"} chrony.conf fi # End automatically added section # Automatically added by dh_installdeb/13.28ubuntu1 dpkg-maintscript-helper rm_conffile /etc/NetworkManager/dispatcher.d/20-chrony 3.5-7\~ chrony -- "$@" # End automatically added section # Automatically added by dh_installinit/13.28ubuntu1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/etc/init.d/chrony" ]; then update-rc.d chrony defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native chrony $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.28ubuntu1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'chrony.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'chrony.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'chrony.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'chrony.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.28ubuntu1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'chrony.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.28ubuntu1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if deb-systemd-helper debian-installed 'chrony-wait.service'; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'chrony-wait.service' >/dev/null || true if deb-systemd-helper --quiet was-enabled 'chrony-wait.service'; then # Create new symlinks, if any. deb-systemd-helper enable 'chrony-wait.service' >/dev/null || true fi fi # Update the statefile to add new symlinks (if any), which need to be cleaned # up on purge. Also remove old symlinks. deb-systemd-helper update-state 'chrony-wait.service' >/dev/null || true fi # End automatically added section exit 0