From 5e51703f064b01a06821dce5422d4718cf81a0fb Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 17 Jul 2009 12:53:22 +0000 Subject: [PATCH] - switch to editline - support arbitrary chronyc commands in init script --- chrony-1.23-editline.patch | 74 ++++++++++++++++++++++++++++++++++++++ chrony.spec | 15 ++++---- chronyd.init | 6 +++- 3 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 chrony-1.23-editline.patch diff --git a/chrony-1.23-editline.patch b/chrony-1.23-editline.patch new file mode 100644 index 0000000..0bba92d --- /dev/null +++ b/chrony-1.23-editline.patch @@ -0,0 +1,74 @@ +commit 84cbeeadd1d3cbdd35a85f9866d08f5507fcaf62 +Author: Miroslav Lichvar +Date: Fri Jul 17 12:38:37 2009 +0200 + + Add editline support + + GNU readline recently changed license to GPLv3+ which makes it + incompatible with chrony (GPLv2). This patch adds support for editline + library (BSD license). + +diff --git a/client.c b/client.c +index b4f65f0..d034982 100644 +--- a/client.c ++++ b/client.c +@@ -41,9 +41,13 @@ + #include "memory.h" + + #ifdef FEAT_READLINE ++#ifdef USE_EDITLINE ++#include ++#else + #include + #include + #endif ++#endif + + #ifdef HAS_STDINT_H + #include +diff --git a/configure b/configure +index 1ff2bbf..3762903 100755 +--- a/configure ++++ b/configure +@@ -129,6 +129,7 @@ for instance \`--prefix=$HOME'. + + For better control, use the options below. + --disable-readline Don't try to use GNU readline ++ --with-editline Use editline library instead of readline + --readline-dir=DIR Specify parent of readline include and lib directories + --readline-inc-dir=DIR Specify where readline include directory is + --readline-lib-dir=DIR Specify where readline lib directory is +@@ -174,6 +175,7 @@ SYSDEFS="" + + # Support for readline (on by default) + feat_readline=1 ++use_editline=0 + feat_rtc=1 + feat_linuxcaps=0 + readline_lib="" +@@ -195,6 +197,9 @@ do + --disable-readline ) + feat_readline=0 + ;; ++ --with-editline ) ++ use_editline=1 ++ ;; + --with-readline-library=* ) + readline_lib=-L`echo $option | sed -e 's/^.*=//;'` + ;; +@@ -341,8 +346,13 @@ else + fi + + if [ $feat_readline = "1" ]; then +- READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc" +- READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses" ++ if [ $use_editline = "1" ]; then ++ READLINE_COMPILE="-DFEAT_READLINE=1 -DUSE_EDITLINE=1 $readline_inc" ++ READLINE_LINK="$readline_lib -ledit" ++ else ++ READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc" ++ READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses" ++ fi + else + READLINE_COMPILE="" + READLINE_LINK="" diff --git a/chrony.spec b/chrony.spec index db77053..e7eb954 100644 --- a/chrony.spec +++ b/chrony.spec @@ -1,6 +1,6 @@ Name: chrony Version: 1.23 -Release: 5.20081106gitbe42b4%{?dist} +Release: 6.20081106gitbe42b4%{?dist} Summary: An NTP client/server Group: System Environment/Daemons @@ -20,9 +20,10 @@ Patch3: chrony-1.23-gethost.patch Patch4: chrony-1.23-res.patch Patch5: chrony-1.23-cap.patch Patch6: chrony-1.23-s390.patch +Patch7: chrony-1.23-editline.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: libcap-devel readline-devel bison texinfo +BuildRequires: libcap-devel libedit-devel bison texinfo Requires(pre): shadow-utils Requires(post): /sbin/chkconfig /sbin/install-info @@ -44,16 +45,14 @@ cp -p %{SOURCE6} . %patch4 -p1 -b .res %patch5 -p1 -b .cap %patch6 -p1 -b .s390 - -# don't link with ncurses -sed -i 's|-lncurses||' configure +%patch7 -p1 -b .editline %build bison -o getdate.c getdate.y export CFLAGS="$RPM_OPT_FLAGS -pie -fpie" # configure doesn't support --bindir --sbindir options, install manually -./configure --enable-linuxcaps +./configure --enable-linuxcaps --with-editline make %{?_smp_mflags} all docs %install @@ -125,6 +124,10 @@ fi %dir %attr(-,chrony,chrony) %{_localstatedir}/log/chrony %changelog +* Fri Jul 17 2009 Miroslav Lichvar 1.23-6.20081106gitbe42b4 +- switch to editline +- support arbitrary chronyc commands in init script + * Mon Jun 08 2009 Dan Horak 1.23-5.20081106gitbe42b4 - add patch with support for s390/s390x diff --git a/chronyd.init b/chronyd.init index f8d33ec..2d7b155 100644 --- a/chronyd.init +++ b/chronyd.init @@ -150,8 +150,12 @@ case "$1" in rh_status_q || exit 7 chrony_command $1 ;; + command) + rh_status_q || exit 7 + chrony_command "$2" + ;; *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|cyclelogs|online|offline}" + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|cyclelogs|online|offline|command}" exit 2 esac exit $?