Revert timedatectl change
This commit is contained in:
parent
0f2f0b41bf
commit
ed92d0ce5a
|
@ -0,0 +1,360 @@
|
||||||
|
From eb15b8e85a567772ba1c07785c7425f8948ea447 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Tue, 7 Oct 2014 23:34:31 -0400
|
||||||
|
Subject: [PATCH] Revert "timedated: manage systemd-timesyncd directly instead
|
||||||
|
of lists of alternatives"
|
||||||
|
|
||||||
|
This reverts commit b72ddf0f4f552dd53d6404b6ddbc9f17d02b8e12.
|
||||||
|
|
||||||
|
Conflicts:
|
||||||
|
Makefile.am
|
||||||
|
NEWS
|
||||||
|
---
|
||||||
|
Makefile.am | 9 ++
|
||||||
|
src/timedate/timedated.c | 254 +++++++++++++++++++++++++++++------------------
|
||||||
|
2 files changed, 169 insertions(+), 94 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile.am b/Makefile.am
|
||||||
|
index e52db1793b..ba7881931e 100644
|
||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -109,6 +109,7 @@ udevrulesdir=$(udevlibexecdir)/rules.d
|
||||||
|
udevhwdbdir=$(udevlibexecdir)/hwdb.d
|
||||||
|
catalogdir=$(prefix)/lib/systemd/catalog
|
||||||
|
kernelinstalldir = $(prefix)/lib/kernel/install.d
|
||||||
|
+ntpunitsdir=$(prefix)/lib/systemd/ntp-units.d
|
||||||
|
factory_etcdir = $(prefix)/share/factory/etc
|
||||||
|
factory_pamdir = $(prefix)/share/factory/etc/pam.d
|
||||||
|
|
||||||
|
@@ -4690,6 +4691,10 @@ dist_systemunit_DATA_busnames += \
|
||||||
|
polkitpolicy_files += \
|
||||||
|
src/timedate/org.freedesktop.timedate1.policy
|
||||||
|
|
||||||
|
+INSTALL_DIRS += \
|
||||||
|
+ $(prefix)/lib/systemd/ntp-units.d \
|
||||||
|
+ $(sysconfdir)/systemd/ntp-units.d
|
||||||
|
+
|
||||||
|
SYSTEM_UNIT_ALIASES += \
|
||||||
|
systemd-timedated.service dbus-org.freedesktop.timedate1.service
|
||||||
|
|
||||||
|
@@ -4768,6 +4773,10 @@ EXTRA_DIST += \
|
||||||
|
|
||||||
|
CLEANFILES += \
|
||||||
|
src/timesync/timesyncd.conf
|
||||||
|
+
|
||||||
|
+dist_ntpunits_DATA = \
|
||||||
|
+ src/timesync/90-systemd.list
|
||||||
|
+
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
|
||||||
|
index fa3f947eaa..9e64e9c629 100644
|
||||||
|
--- a/src/timedate/timedated.c
|
||||||
|
+++ b/src/timedate/timedated.c
|
||||||
|
@@ -180,145 +180,211 @@ static int context_write_data_local_rtc(Context *c) {
|
||||||
|
return write_string_file_atomic_label("/etc/adjtime", w);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static char** get_ntp_services(void) {
|
||||||
|
+ _cleanup_strv_free_ char **r = NULL, **files = NULL;
|
||||||
|
+ char **i;
|
||||||
|
+ int k;
|
||||||
|
+
|
||||||
|
+ k = conf_files_list(&files, ".list", NULL,
|
||||||
|
+ "/etc/systemd/ntp-units.d",
|
||||||
|
+ "/run/systemd/ntp-units.d",
|
||||||
|
+ "/usr/local/lib/systemd/ntp-units.d",
|
||||||
|
+ "/usr/lib/systemd/ntp-units.d",
|
||||||
|
+ NULL);
|
||||||
|
+ if (k < 0)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ STRV_FOREACH(i, files) {
|
||||||
|
+ _cleanup_fclose_ FILE *f;
|
||||||
|
+
|
||||||
|
+ f = fopen(*i, "re");
|
||||||
|
+ if (!f)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ for (;;) {
|
||||||
|
+ char line[PATH_MAX], *l;
|
||||||
|
+
|
||||||
|
+ if (!fgets(line, sizeof(line), f)) {
|
||||||
|
+ if (ferror(f))
|
||||||
|
+ log_error("Failed to read NTP unit file: %m");
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ l = strstrip(line);
|
||||||
|
+ if (l[0] == 0 || l[0] == '#')
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (strv_extend(&r, l) < 0) {
|
||||||
|
+ log_oom();
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ i = r;
|
||||||
|
+ r = NULL; /* avoid cleanup */
|
||||||
|
+
|
||||||
|
+ return strv_uniq(i);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int context_read_ntp(Context *c, sd_bus *bus) {
|
||||||
|
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||||
|
- sd_bus_message *reply = NULL;
|
||||||
|
- const char *s;
|
||||||
|
+ _cleanup_strv_free_ char **l;
|
||||||
|
+ char **i;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(c);
|
||||||
|
assert(bus);
|
||||||
|
|
||||||
|
- r = sd_bus_call_method(
|
||||||
|
- bus,
|
||||||
|
- "org.freedesktop.systemd1",
|
||||||
|
- "/org/freedesktop/systemd1",
|
||||||
|
- "org.freedesktop.systemd1.Manager",
|
||||||
|
- "GetUnitFileState",
|
||||||
|
- &error,
|
||||||
|
- &reply,
|
||||||
|
- "s",
|
||||||
|
- "systemd-timesyncd.service");
|
||||||
|
+ l = get_ntp_services();
|
||||||
|
+ STRV_FOREACH(i, l) {
|
||||||
|
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||||
|
+ sd_bus_message *reply = NULL;
|
||||||
|
+ const char *s;
|
||||||
|
|
||||||
|
- if (r < 0) {
|
||||||
|
- if (sd_bus_error_has_name(&error, SD_BUS_ERROR_FILE_NOT_FOUND) ||
|
||||||
|
- sd_bus_error_has_name(&error, "org.freedesktop.systemd1.LoadFailed") ||
|
||||||
|
- sd_bus_error_has_name(&error, "org.freedesktop.systemd1.NoSuchUnit"))
|
||||||
|
- return 0;
|
||||||
|
+ r = sd_bus_call_method(
|
||||||
|
+ bus,
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ "GetUnitFileState",
|
||||||
|
+ &error,
|
||||||
|
+ &reply,
|
||||||
|
+ "s",
|
||||||
|
+ *i);
|
||||||
|
|
||||||
|
- return r;
|
||||||
|
- }
|
||||||
|
+ if (r < 0) {
|
||||||
|
+ /* This implementation does not exist. Try the next one. */
|
||||||
|
+ if (sd_bus_error_has_name(&error, SD_BUS_ERROR_FILE_NOT_FOUND))
|
||||||
|
+ continue;
|
||||||
|
|
||||||
|
- r = sd_bus_message_read(reply, "s", &s);
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
+ return r;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ r = sd_bus_message_read(reply, "s", &s);
|
||||||
|
+ if (r < 0)
|
||||||
|
+ return r;
|
||||||
|
|
||||||
|
- c->can_ntp = true;
|
||||||
|
- c->use_ntp = STR_IN_SET(s, "enabled", "enabled-runtime");
|
||||||
|
+ c->can_ntp = true;
|
||||||
|
+ c->use_ntp = STR_IN_SET(s, "enabled", "enabled-runtime");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int context_start_ntp(Context *c, sd_bus *bus, sd_bus_error *error) {
|
||||||
|
+ _cleanup_strv_free_ char **l = NULL;
|
||||||
|
+ char **i;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(c);
|
||||||
|
assert(bus);
|
||||||
|
assert(error);
|
||||||
|
|
||||||
|
- if (c->use_ntp)
|
||||||
|
- r = sd_bus_call_method(
|
||||||
|
- bus,
|
||||||
|
- "org.freedesktop.systemd1",
|
||||||
|
- "/org/freedesktop/systemd1",
|
||||||
|
- "org.freedesktop.systemd1.Manager",
|
||||||
|
- "StartUnit",
|
||||||
|
- error,
|
||||||
|
- NULL,
|
||||||
|
- "ss",
|
||||||
|
- "systemd-timesyncd.service",
|
||||||
|
- "replace");
|
||||||
|
- else
|
||||||
|
- r = sd_bus_call_method(
|
||||||
|
- bus,
|
||||||
|
- "org.freedesktop.systemd1",
|
||||||
|
- "/org/freedesktop/systemd1",
|
||||||
|
- "org.freedesktop.systemd1.Manager",
|
||||||
|
- "StopUnit",
|
||||||
|
- error,
|
||||||
|
- NULL,
|
||||||
|
- "ss",
|
||||||
|
- "systemd-timesyncd.service",
|
||||||
|
- "replace");
|
||||||
|
+ l = get_ntp_services();
|
||||||
|
+ STRV_FOREACH(i, l) {
|
||||||
|
+
|
||||||
|
+ if (c->use_ntp)
|
||||||
|
+ r = sd_bus_call_method(
|
||||||
|
+ bus,
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ "StartUnit",
|
||||||
|
+ error,
|
||||||
|
+ NULL,
|
||||||
|
+ "ss", *i, "replace");
|
||||||
|
+ else
|
||||||
|
+ r = sd_bus_call_method(
|
||||||
|
+ bus,
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ "StopUnit",
|
||||||
|
+ error,
|
||||||
|
+ NULL,
|
||||||
|
+ "ss", *i, "replace");
|
||||||
|
+
|
||||||
|
+ if (r < 0) {
|
||||||
|
+ if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND) ||
|
||||||
|
+ sd_bus_error_has_name(error, "org.freedesktop.systemd1.LoadFailed") ||
|
||||||
|
+ sd_bus_error_has_name(error, "org.freedesktop.systemd1.NoSuchUnit")) {
|
||||||
|
+ /* This implementation does not exist. Try the next one. */
|
||||||
|
+ sd_bus_error_free(error);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (r < 0) {
|
||||||
|
- if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND) ||
|
||||||
|
- sd_bus_error_has_name(error, "org.freedesktop.systemd1.LoadFailed") ||
|
||||||
|
- sd_bus_error_has_name(error, "org.freedesktop.systemd1.NoSuchUnit")) {
|
||||||
|
- sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
|
||||||
|
- return -ENOTSUP;
|
||||||
|
+ return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return r;
|
||||||
|
+ return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
|
||||||
|
+ return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int context_enable_ntp(Context*c, sd_bus *bus, sd_bus_error *error) {
|
||||||
|
+ _cleanup_strv_free_ char **l = NULL;
|
||||||
|
+ char **i;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(c);
|
||||||
|
assert(bus);
|
||||||
|
assert(error);
|
||||||
|
|
||||||
|
- if (c->use_ntp)
|
||||||
|
- r = sd_bus_call_method(
|
||||||
|
- bus,
|
||||||
|
- "org.freedesktop.systemd1",
|
||||||
|
- "/org/freedesktop/systemd1",
|
||||||
|
- "org.freedesktop.systemd1.Manager",
|
||||||
|
- "EnableUnitFiles",
|
||||||
|
- error,
|
||||||
|
- NULL,
|
||||||
|
- "asbb", 1,
|
||||||
|
- "systemd-timesyncd.service",
|
||||||
|
- false, true);
|
||||||
|
- else
|
||||||
|
+ l = get_ntp_services();
|
||||||
|
+ STRV_FOREACH(i, l) {
|
||||||
|
+ if (c->use_ntp)
|
||||||
|
+ r = sd_bus_call_method(
|
||||||
|
+ bus,
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ "EnableUnitFiles",
|
||||||
|
+ error,
|
||||||
|
+ NULL,
|
||||||
|
+ "asbb", 1, *i, false, true);
|
||||||
|
+ else
|
||||||
|
+ r = sd_bus_call_method(
|
||||||
|
+ bus,
|
||||||
|
+ "org.freedesktop.systemd1",
|
||||||
|
+ "/org/freedesktop/systemd1",
|
||||||
|
+ "org.freedesktop.systemd1.Manager",
|
||||||
|
+ "DisableUnitFiles",
|
||||||
|
+ error,
|
||||||
|
+ NULL,
|
||||||
|
+ "asb", 1, *i, false);
|
||||||
|
+
|
||||||
|
+ if (r < 0) {
|
||||||
|
+ if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND)) {
|
||||||
|
+ /* This implementation does not exist. Try the next one. */
|
||||||
|
+ sd_bus_error_free(error);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return r;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
r = sd_bus_call_method(
|
||||||
|
bus,
|
||||||
|
"org.freedesktop.systemd1",
|
||||||
|
"/org/freedesktop/systemd1",
|
||||||
|
"org.freedesktop.systemd1.Manager",
|
||||||
|
- "DisableUnitFiles",
|
||||||
|
+ "Reload",
|
||||||
|
error,
|
||||||
|
NULL,
|
||||||
|
- "asb", 1,
|
||||||
|
- "systemd-timesyncd.service",
|
||||||
|
- false);
|
||||||
|
-
|
||||||
|
- if (r < 0) {
|
||||||
|
- if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND)) {
|
||||||
|
- sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
|
||||||
|
- return -ENOTSUP;
|
||||||
|
- }
|
||||||
|
+ NULL);
|
||||||
|
+ if (r < 0)
|
||||||
|
+ return r;
|
||||||
|
|
||||||
|
- return r;
|
||||||
|
+ return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- r = sd_bus_call_method(
|
||||||
|
- bus,
|
||||||
|
- "org.freedesktop.systemd1",
|
||||||
|
- "/org/freedesktop/systemd1",
|
||||||
|
- "org.freedesktop.systemd1.Manager",
|
||||||
|
- "Reload",
|
||||||
|
- error,
|
||||||
|
- NULL,
|
||||||
|
- NULL);
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
-
|
||||||
|
- return 0;
|
||||||
|
+ sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
|
||||||
|
+ return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int property_get_rtc_time(
|
|
@ -574,7 +574,7 @@ Patch0532: 0532-proc-sys-prefixes-are-not-necessary-for-sysctl-anymo.patch
|
||||||
Patch0533: 0533-core-don-t-allow-enabling-if-unit-is-masked.patch
|
Patch0533: 0533-core-don-t-allow-enabling-if-unit-is-masked.patch
|
||||||
Patch0534: 0534-fedora-disable-resolv.conf-symlink.patch
|
Patch0534: 0534-fedora-disable-resolv.conf-symlink.patch
|
||||||
Patch0535: 0535-fedora-add-bridge-sysctl-configuration.patch
|
Patch0535: 0535-fedora-add-bridge-sysctl-configuration.patch
|
||||||
|
Patch0536: 0536-Revert-timedated-manage-systemd-timesyncd-directly-i.patch
|
||||||
|
|
||||||
# kernel-install patch for grubby, drop if grubby is obsolete
|
# kernel-install patch for grubby, drop if grubby is obsolete
|
||||||
Patch1000: kernel-install-grubby.patch
|
Patch1000: kernel-install-grubby.patch
|
||||||
|
@ -802,6 +802,8 @@ systemd-journal-gatewayd serves journal events over the network using HTTP.
|
||||||
sed -r -i 's/\blibsystemd-(login|journal|id128|daemon).c \\/\\/' Makefile.am
|
sed -r -i 's/\blibsystemd-(login|journal|id128|daemon).c \\/\\/' Makefile.am
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
echo systemd-timesyncd.service > src/timesync/90-systemd.list
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if %{defined gitcommit}
|
%if %{defined gitcommit}
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
@ -1278,6 +1280,7 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
|
||||||
%{_prefix}/lib/systemd/network/99-default.link
|
%{_prefix}/lib/systemd/network/99-default.link
|
||||||
%{_prefix}/lib/systemd/network/80-container-host0.network
|
%{_prefix}/lib/systemd/network/80-container-host0.network
|
||||||
%{_prefix}/lib/systemd/network/80-container-ve.network
|
%{_prefix}/lib/systemd/network/80-container-ve.network
|
||||||
|
%{_prefix}/lib/systemd/ntp-units.d
|
||||||
|
|
||||||
# Make sure we don't remove runlevel targets from F14 alpha installs,
|
# Make sure we don't remove runlevel targets from F14 alpha installs,
|
||||||
# but make sure we don't create then anew.
|
# but make sure we don't create then anew.
|
||||||
|
@ -1354,9 +1357,9 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
|
||||||
%{_datadir}/systemd/gatewayd
|
%{_datadir}/systemd/gatewayd
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Oct 07 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 216-2
|
* Tue Oct 07 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 216-2
|
||||||
- Update to latest git, but without the readahead removal patch
|
- Update to latest git, but without the readahead removal patch
|
||||||
(#1114786, #1141137)
|
and without the timedatectl change (#1114786, #1141137).
|
||||||
|
|
||||||
* Tue Oct 07 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 216-1
|
* Tue Oct 07 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 216-1
|
||||||
- New upstream release
|
- New upstream release
|
||||||
|
|
Loading…
Reference in New Issue