- switch to editline

- support arbitrary chronyc commands in init script
This commit is contained in:
Miroslav Lichvar 2009-07-17 12:53:22 +00:00
parent 90258c8db2
commit 5e51703f06
3 changed files with 88 additions and 7 deletions

View File

@ -0,0 +1,74 @@
commit 84cbeeadd1d3cbdd35a85f9866d08f5507fcaf62
Author: Miroslav Lichvar <mlichvar@redhat.com>
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 <editline/readline.h>
+#else
#include <readline/readline.h>
#include <readline/history.h>
#endif
+#endif
#ifdef HAS_STDINT_H
#include <stdint.h>
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=""

View File

@ -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 <mlichvar@redhat.com> 1.23-6.20081106gitbe42b4
- switch to editline
- support arbitrary chronyc commands in init script
* Mon Jun 08 2009 Dan Horak <dan[at]danny.cz> 1.23-5.20081106gitbe42b4
- add patch with support for s390/s390x

View File

@ -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 $?