Skip to content
Snippets Groups Projects
Commit d6483013 authored by Balint Reczey's avatar Balint Reczey
Browse files

Ship systemd-timesyncd in a separate package


The new systemd-timesyncd package conflicting with other NTP-related
packages resolves the problems arising when installing systemd-timesyncd
and other NTP servers on the same system.

Co-authored-by: default avatarMichael Biebl <biebl@debian.org>
LP: #1849156
Closes: #805927, #947936
parent 74164865
No related branches found
No related tags found
2 merge requests!97WIP: Upstream ci rebase,!61Ship systemd-timesyncd in a separate package
......@@ -71,6 +71,7 @@ Pre-Depends: ${shlibs:Pre-Depends},
Depends: ${shlibs:Depends},
${misc:Depends},
libsystemd0 (= ${binary:Version}),
systemd-timesyncd | time-daemon,
util-linux (>= 2.27.1),
mount (>= 2.26),
adduser,
......@@ -176,6 +177,25 @@ Description: tools for storing and retrieving coredumps
* systemd-coredump
* coredumpctl
Package: systemd-timesyncd
Architecture: linux-any
Multi-Arch: foreign
Section: admin
Priority: optional
Depends: ${shlibs:Depends},
${misc:Depends},
systemd
Breaks: systemd (<< 245.4-2~),
Conflicts: time-daemon,
virtualbox-guest-utils,
virtualbox-guest-utils-hwe
Replaces: time-daemon,
systemd (<< 245.4-2~),
Provides: time-daemon
Description: minimalistic service to synchronize local time with NTP servers
The package contains the systemd-timesyncd system service that may be used to
synchronize the local system clock with a remote Network Time Protocol server.
Package: systemd-tests
Architecture: linux-any
Section: admin
......
[Unit]
# don't run timesyncd if we have another NTP daemon installed
ConditionFileIsExecutable=!/usr/sbin/ntpd
ConditionFileIsExecutable=!/usr/sbin/openntpd
ConditionFileIsExecutable=!/usr/sbin/chronyd
ConditionFileIsExecutable=!/usr/sbin/VBoxService
......@@ -283,6 +283,12 @@ override_dh_missing:
override_dh_installinit:
dh_installinit --no-start
override_dh_systemd_enable:
dh_systemd_enable -psystemd-timesyncd
override_dh_systemd_start:
dh_systemd_start -psystemd-timesyncd
PROJECT_VERSION ?= $(shell awk '/(PROJECT|PACKAGE)_VERSION/ {print $$3}' build-deb/config.h | tr -d \")
# The SysV compat tools (which are symlinks to systemctl) are
......@@ -310,4 +316,4 @@ ifeq (, $(filter nocheck, $(DEB_BUILD_OPTIONS)))
endif
%:
dh $@ --without autoreconf,systemd --buildsystem=meson
dh $@ --without autoreconf --buildsystem=meson
../../extra/dhclient-exit-hooks.d/ etc/dhcp/
etc/systemd/timesyncd.conf
lib/systemd/ntp-units.d/80-systemd-timesync.list
lib/systemd/systemd-timesyncd
lib/systemd/system/systemd-timesyncd.service
usr/share/dbus-1/*/*timesync*
usr/share/man/man*/*timesyncd*
#!/bin/sh
set -e
_systemctl() {
if [ -d /run/systemd/system ]; then
systemctl "$@"
fi
}
_adopt_conffile() {
conffile=$1
pkg=$2
[ -f ${conffile}.dpkg-bak ] || return 0
md5sum="$(md5sum ${conffile} | sed -e 's/ .*//')"
old_md5sum="$(dpkg-query -W -f='${Conffiles}' $pkg | \
sed -n -e "\' ${conffile} ' { s/ obsolete$//; s/.* //; p }")"
# On new installs, if the policy file was preserved on systemd upgrade
# by dpkg-maintscript helper, copy it back if the new file has not been modified yet
if [ "$md5sum" = "$old_md5sum" ]; then
mv ${conffile}.dpkg-bak ${conffile}
fi
}
adduser --quiet --system --group --no-create-home --home /run/systemd \
--gecos "systemd Time Synchronization" systemd-timesync
if [ "$1" = configure ] && [ -z "$2" ]; then
_adopt_conffile /etc/dhcp/dhclient-exit-hooks.d/timesyncd systemd-timesyncd
_adopt_conffile /etc/systemd/timesyncd.conf systemd-timesyncd
fi
#DEBHELPER#
#!/bin/sh
set -e
case "$1" in
purge)
rm -rf /var/lib/systemd/timesync/
;;
esac
#DEBHELPER#
......@@ -67,6 +67,5 @@ var/lib
../../extra/tmpfiles.d/*.conf usr/lib/tmpfiles.d/
../../extra/systemd-sysv-install lib/systemd/
../../extra/units/* lib/systemd/system/
../../extra/dhclient-exit-hooks.d/ etc/dhcp/
../../extra/kernel-install.d/* usr/lib/kernel/install.d
../../extra/pam.d etc/
systemd: maintainer-script-calls-systemctl
systemd: maintainer-script-should-not-use-dpkg-maintscript-helper
......@@ -7,3 +7,5 @@ rm_conffile /etc/dbus-1/system.d/org.freedesktop.resolve1.conf 233-3~
rm_conffile /etc/dbus-1/system.d/org.freedesktop.systemd1.conf 233-3~
rm_conffile /etc/dbus-1/system.d/org.freedesktop.timedate1.conf 233-3~
rm_conffile /etc/dbus-1/system.d/org.freedesktop.systemd-shim.conf 239-15~ systemd-shim
rm_conffile /etc/dhcp/dhclient-exit-hooks.d/timesyncd 245.4-2~
rm_conffile /etc/systemd/timesyncd.conf 245.4-2~
......@@ -28,11 +28,10 @@ if [ "$1" = "triggered" ]; then
exit 0
fi
# Enable getty, remote-fs.target and timesyncd by default on new installs
# 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
systemctl enable systemd-timesyncd.service || true
fi
# Enable ondemand by default on new installs
......@@ -97,8 +96,6 @@ 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 Time Synchronization" systemd-timesync
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 \
......@@ -125,7 +122,6 @@ if [ -n "$2" ]; then
# https://github.com/systemd/systemd/issues/1163
_systemctl try-restart systemd-networkd.service || true
_systemctl try-restart systemd-resolved.service || true
_systemctl try-restart systemd-timesyncd.service || true
_systemctl try-restart systemd-journald.service || true
fi
......
#!/bin/sh
set -e
_systemctl() {
if [ -d /run/systemd/system ]; then
systemctl "$@"
fi
}
#DEBHELPER#
# Clean up after package split. If the new systemd-timesyncd package is
# installed, it will enable and start the service again.
if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" lt-nl "245.4-2~"; then
if _systemctl -q is-active systemd-timesyncd.service; then
_systemctl stop systemd-timesyncd.service || true
fi
rm -f /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service
# Don't bother with cleaning up the systemd-timesync group
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment