[gnome-settings-daemon] Add support for chrony (#723212)
Tomas Bzatek
tbzatek at fedoraproject.org
Fri Jul 22 12:31:21 UTC 2011
commit dfea2c727020040c5cc669a5d22b6e2ddf50e31b
Author: Tomas Bzatek <tbzatek at redhat.com>
Date: Fri Jul 22 14:31:05 2011 +0200
Add support for chrony (#723212)
chrony-support.patch | 84 ++++++++++++++++++++++++++++++++++++++++++++
gnome-settings-daemon.spec | 12 +++++-
2 files changed, 94 insertions(+), 2 deletions(-)
---
diff --git a/chrony-support.patch b/chrony-support.patch
new file mode 100644
index 0000000..fb3b537
--- /dev/null
+++ b/chrony-support.patch
@@ -0,0 +1,84 @@
+commit 44d7412eb6eb893a20bd82fb65d17e2da65636ee
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date: Tue Jul 19 14:09:23 2011 +0200
+
+ datetime: Add support for chrony NTP client
+
+diff --git a/plugins/datetime/gsd-datetime-mechanism-fedora.c b/plugins/datetime/gsd-datetime-mechanism-fedora.c
+index 9333d24..b0ad6e5 100644
+--- a/plugins/datetime/gsd-datetime-mechanism-fedora.c
++++ b/plugins/datetime/gsd-datetime-mechanism-fedora.c
+@@ -28,6 +28,18 @@
+ #include "gsd-datetime-mechanism-fedora.h"
+ #include "gsd-datetime-mechanism.h"
+
++/* Return the name of the installed NTP client, prefer chrony if both chrony
++ * and ntp are installed */
++static const char
++*get_ntp_client ()
++{
++ if (g_file_test ("/etc/chrony.conf", G_FILE_TEST_EXISTS))
++ return "chrony";
++ else if (g_file_test ("/etc/ntp.conf", G_FILE_TEST_EXISTS))
++ return "ntp";
++ return NULL;
++}
++
+ gboolean
+ _get_using_ntp_fedora (DBusGMethodInvocation *context)
+ {
+@@ -35,10 +47,14 @@ _get_using_ntp_fedora (DBusGMethodInvocation *context)
+ GError *error = NULL;
+ gboolean can_use_ntp;
+ gboolean is_using_ntp;
++ const char *ntp_client;
++ char *cmd;
+
+- if (g_file_test ("/etc/ntp.conf", G_FILE_TEST_EXISTS)) {
++ ntp_client = get_ntp_client();
++ if (ntp_client) {
+ can_use_ntp = TRUE;
+- if (!g_spawn_command_line_sync ("/sbin/service ntpd status",
++ cmd = g_strconcat ("/sbin/service ", ntp_client, "d status", NULL);
++ if (!g_spawn_command_line_sync (cmd,
+ NULL, NULL, &exit_status, &error)) {
+ GError *error2;
+ error2 = g_error_new (GSD_DATETIME_MECHANISM_ERROR,
+@@ -47,8 +63,10 @@ _get_using_ntp_fedora (DBusGMethodInvocation *context)
+ g_error_free (error);
+ dbus_g_method_return_error (context, error2);
+ g_error_free (error2);
++ g_free (cmd);
+ return FALSE;
+ }
++ g_free (cmd);
+ if (exit_status == 0)
+ is_using_ntp = TRUE;
+ else
+@@ -69,13 +87,16 @@ _set_using_ntp_fedora (DBusGMethodInvocation *context,
+ {
+ GError *error;
+ int exit_status;
++ const char *ntp_client;
+ char *cmd;
+
+ error = NULL;
+
++ ntp_client = get_ntp_client();
++
+ /* We omit --level 2345 so that systemd doesn't try to use the
+ * SysV init scripts */
+- cmd = g_strconcat ("/sbin/chkconfig ntpd ", using_ntp ? "on" : "off", NULL);
++ cmd = g_strconcat ("/sbin/chkconfig ", ntp_client, "d ", using_ntp ? "on" : "off", NULL);
+
+ if (!g_spawn_command_line_sync (cmd,
+ NULL, NULL, &exit_status, &error)) {
+@@ -92,7 +113,7 @@ _set_using_ntp_fedora (DBusGMethodInvocation *context,
+
+ g_free (cmd);
+
+- cmd = g_strconcat ("/sbin/service ntpd ", using_ntp ? "restart" : "stop", NULL);;
++ cmd = g_strconcat ("/sbin/service ", ntp_client, "d ", using_ntp ? "restart" : "stop", NULL);;
+
+ if (!g_spawn_command_line_sync (cmd,
+ NULL, NULL, &exit_status, &error)) {
diff --git a/gnome-settings-daemon.spec b/gnome-settings-daemon.spec
index 2e00c26..9611fe1 100644
--- a/gnome-settings-daemon.spec
+++ b/gnome-settings-daemon.spec
@@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 3.1.3
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@@ -9,6 +9,10 @@ URL: http://download.gnome.org/sources/%{name}
#VCS: git:git://git.gnome.org/gnome-settings-daemon
Source: http://download.gnome.org/sources/%{name}/3.1/%{name}-%{version}.tar.xz
+# RFE: add support for chrony
+# https://bugzilla.redhat.com/show_bug.cgi?id=723212
+Patch0: chrony-support.patch
+
Requires(pre): GConf2 >= 2.14
Requires(preun): GConf2 >= 2.14
Requires(post): GConf2 >= 2.14
@@ -58,6 +62,7 @@ developing applications that use %{name}.
%prep
%setup -q
+%patch0 -p1 -b .chrony
# autoreconf -i -f
@@ -222,7 +227,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gnome-settings-daemon-3.0/input-device-example.sh
%changelog
-* Mon Jul 04 2011 Bastien Nocera <bnocera at redhat.com> 3.1.3.-1
+* Fri Jul 22 2011 Tomas Bzatek <tbzatek at redhat.com> - 3.1.3-2
+- Add support for chrony (#723212)
+
+* Mon Jul 04 2011 Bastien Nocera <bnocera at redhat.com> 3.1.3-1
- Update to 3.1.3
* Tue Jun 21 2011 Tomas Bzatek <tbzatek at redhat.com> - 3.1.2-2
More information about the scm-commits
mailing list