diff options
author | Christoph Junghans <ottxor@gentoo.org> | 2013-12-02 13:32:13 +0000 |
---|---|---|
committer | Christoph Junghans <ottxor@gentoo.org> | 2013-12-02 13:32:13 +0000 |
commit | 7a3c93412c429d17ed6b016e96334f23874802ad (patch) | |
tree | 77071bf5e86e233ba8ad3338f3767e284f423559 /net-misc/openntpd | |
parent | Override bdist_egg->build_dir via pydistutils.cfg rather than extra command. ... (diff) | |
download | gentoo-2-7a3c93412c429d17ed6b016e96334f23874802ad.tar.gz gentoo-2-7a3c93412c429d17ed6b016e96334f23874802ad.tar.bz2 gentoo-2-7a3c93412c429d17ed6b016e96334f23874802ad.zip |
added pidfile support (bug #493082), fixed ignored NTPD_OPTS for USE=syslog (bug #493032)
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key C2000586)
Diffstat (limited to 'net-misc/openntpd')
-rw-r--r-- | net-misc/openntpd/ChangeLog | 11 | ||||
-rw-r--r-- | net-misc/openntpd/files/openntpd-20080406-pidfile.patch | 141 | ||||
-rw-r--r-- | net-misc/openntpd/files/openntpd.conf.d-20080406-r6 | 7 | ||||
-rw-r--r-- | net-misc/openntpd/files/openntpd.init.d-20080406-r6 | 15 | ||||
-rw-r--r-- | net-misc/openntpd/openntpd-20080406-r6.ebuild (renamed from net-misc/openntpd/openntpd-20080406-r5.ebuild) | 23 |
5 files changed, 187 insertions, 10 deletions
diff --git a/net-misc/openntpd/ChangeLog b/net-misc/openntpd/ChangeLog index 58b91fa6d62b..87455a07abf9 100644 --- a/net-misc/openntpd/ChangeLog +++ b/net-misc/openntpd/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for net-misc/openntpd # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/ChangeLog,v 1.96 2013/12/01 21:07:36 ottxor Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/ChangeLog,v 1.97 2013/12/02 13:32:13 ottxor Exp $ + +*openntpd-20080406-r6 (02 Dec 2013) + + 02 Dec 2013; Christoph Junghans <ottxor@gentoo.org> + +files/openntpd-20080406-pidfile.patch, +files/openntpd.conf.d-20080406-r6, + +files/openntpd.init.d-20080406-r6, +openntpd-20080406-r6.ebuild, + -openntpd-20080406-r5.ebuild: + added pidfile support (bug #493082), fixed ignored NTPD_OPTS for USE=syslog + (bug #493032) 01 Dec 2013; Christoph Junghans <ottxor@gentoo.org> openntpd-20080406-r5.ebuild: diff --git a/net-misc/openntpd/files/openntpd-20080406-pidfile.patch b/net-misc/openntpd/files/openntpd-20080406-pidfile.patch new file mode 100644 index 000000000000..d2ee38504c3e --- /dev/null +++ b/net-misc/openntpd/files/openntpd-20080406-pidfile.patch @@ -0,0 +1,141 @@ +adding a -p option to openntpd to create a pidfile + +https://bugs.gentoo.org/show_bug.cgi?id=493082 + +diff -u -r openntpd-20080406p.orig/ntpd.8 openntpd-20080406p/ntpd.8 +--- openntpd-20080406p.orig/ntpd.8 2013-12-01 12:49:49.773116316 -0800 ++++ openntpd-20080406p/ntpd.8 2013-12-01 13:27:39.417324497 -0800 +@@ -25,6 +25,7 @@ + .Bk -words + .Op Fl dnSsv + .Op Fl f Ar file ++.Op Fl p Ar file + .Ek + .Sh DESCRIPTION + The +@@ -63,13 +64,16 @@ + .Xr ntpd.conf 5 . + .Pp + The options are as follows: +-.Bl -tag -width "-f fileXXX" ++.Bl -tag -width "-p fileXXX" + .It Fl d + Do not daemonize. + If this option is specified, + .Nm + will run in the foreground and log to + .Em stderr . ++.It Fl p Ar file ++Write pid to ++.Ar file + .It Fl f Ar file + Use + .Ar file +diff -u -r openntpd-20080406p.orig/ntpd.c openntpd-20080406p/ntpd.c +--- openntpd-20080406p.orig/ntpd.c 2013-12-01 12:49:49.774116176 -0800 ++++ openntpd-20080406p/ntpd.c 2013-12-01 13:31:43.964616270 -0800 +@@ -78,7 +78,7 @@ + { + extern char *__progname; + +- fprintf(stderr, "usage: %s [-dnSsv] [-f file]\n", __progname); ++ fprintf(stderr, "usage: %s [-dnSsv] [-f file] [-p file]\n", __progname); + exit(1); + } + +@@ -105,7 +105,7 @@ + log_init(1); /* log to stderr until daemonized */ + res_init(); /* XXX */ + +- while ((ch = getopt(argc, argv, "df:nsSv")) != -1) { ++ while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) { + switch (ch) { + case 'd': + lconf.debug = 1; +@@ -116,6 +116,9 @@ + case 'n': + lconf.noaction = 1; + break; ++ case 'p': ++ lconf.pid_file = optarg; ++ break; + case 's': + lconf.settime = 1; + break; +@@ -157,9 +160,17 @@ + reset_adjtime(); + if (!lconf.settime) { + log_init(lconf.debug); +- if (!lconf.debug) ++ if (!lconf.debug) { + if (daemon(1, 0)) + fatal("daemon"); ++ else if (lconf.pid_file != NULL) { ++ FILE *f = fopen(lconf.pid_file, "w"); ++ if (f == NULL) ++ fatal("couldn't open pid file"); ++ fprintf(f, "%ld\n", (long) getpid()); ++ fclose(f); ++ } ++ } + } else + timeout = SETTIME_TIMEOUT * 1000; + +@@ -201,9 +212,17 @@ + log_init(lconf.debug); + log_debug("no reply received in time, skipping initial " + "time setting"); +- if (!lconf.debug) ++ if (!lconf.debug) { + if (daemon(1, 0)) + fatal("daemon"); ++ else if (lconf.pid_file != NULL) { ++ FILE *f = fopen(lconf.pid_file, "w"); ++ if (f == NULL) ++ fatal("couldn't open pid file"); ++ fprintf(f, "%ld\n", (long) getpid()); ++ fclose(f); ++ } ++ } + } + + if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) +@@ -242,6 +261,8 @@ + msgbuf_clear(&ibuf->w); + free(ibuf); + log_info("Terminating"); ++ if (lconf.pid_file != NULL) ++ unlink(lconf.pid_file); + return (0); + } + +@@ -316,9 +337,17 @@ + memcpy(&d, imsg.data, sizeof(d)); + ntpd_settime(d); + /* daemonize now */ +- if (!lconf->debug) ++ if (!lconf->debug) { + if (daemon(1, 0)) + fatal("daemon"); ++ else if (lconf->pid_file != NULL) { ++ FILE *f = fopen(lconf->pid_file, "w"); ++ if (f == NULL) ++ fatal("couldn't open pid file"); ++ fprintf(f, "%ld\n", (long) getpid()); ++ fclose(f); ++ } ++ } + lconf->settime = 0; + break; + case IMSG_HOST_DNS: +diff -u -r openntpd-20080406p.orig/ntpd.h openntpd-20080406p/ntpd.h +--- openntpd-20080406p.orig/ntpd.h 2013-12-01 12:49:49.773116316 -0800 ++++ openntpd-20080406p/ntpd.h 2013-12-01 12:54:02.023313872 -0800 +@@ -178,6 +178,7 @@ + u_int8_t debug; + u_int32_t scale; + u_int8_t noaction; ++ char *pid_file; + }; + + struct buf { diff --git a/net-misc/openntpd/files/openntpd.conf.d-20080406-r6 b/net-misc/openntpd/files/openntpd.conf.d-20080406-r6 new file mode 100644 index 000000000000..ccd45459664c --- /dev/null +++ b/net-misc/openntpd/files/openntpd.conf.d-20080406-r6 @@ -0,0 +1,7 @@ +# /etc/conf.d/ntpd: config file for openntpd's ntpd + +# See ntpd(8) man page ... some popular options: +# -s Set the time immediately at startup +# (Note: may cause up to a 15 second startup delay +# if ntp servers not reachable) +NTPD_OPTS="" diff --git a/net-misc/openntpd/files/openntpd.init.d-20080406-r6 b/net-misc/openntpd/files/openntpd.init.d-20080406-r6 new file mode 100644 index 000000000000..2f452e0fd015 --- /dev/null +++ b/net-misc/openntpd/files/openntpd.init.d-20080406-r6 @@ -0,0 +1,15 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/files/openntpd.init.d-20080406-r6,v 1.1 2013/12/02 13:32:12 ottxor Exp $ + +name="OpenNTPD" +command="/usr/sbin/ntpd" +pidfile="/run/ntpd.pid" +command_args="-p ${pidfile} ${NTPD_OPTS}" + +depend() { + need net + after ntp-client + use dns logger +} diff --git a/net-misc/openntpd/openntpd-20080406-r5.ebuild b/net-misc/openntpd/openntpd-20080406-r6.ebuild index cbaf792db1c8..f690ed753f87 100644 --- a/net-misc/openntpd/openntpd-20080406-r5.ebuild +++ b/net-misc/openntpd/openntpd-20080406-r6.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/openntpd-20080406-r5.ebuild,v 1.2 2013/12/01 21:07:36 ottxor Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/openntpd-20080406-r6.ebuild,v 1.1 2013/12/02 13:32:13 ottxor Exp $ EAPI=5 @@ -47,6 +47,7 @@ src_prepare() { sed -i '/NTPD_USER/s:_ntp:ntp:' ntpd.h || die epatch "${WORKDIR}"/debian/patches/*.patch + epatch "${FILESDIR}/${P}-pidfile.patch" sed -i 's:debian:gentoo:g' ntpd.conf || die eautoreconf # deb patchset touches .ac files and such } @@ -61,13 +62,14 @@ src_configure() { src_install() { default - cp "${FILESDIR}/${PN}.init.d-${PV}-r4" "${T}/ntpd" || die - use !syslog || sed -e '8,12d' -i "${T}/ntpd" || die - doinitd "${T}/ntpd" - newconfd "${FILESDIR}/${PN}.conf.d-${PV}-r3" ntpd - - insinto /etc/logrotate.d - newins "${FILESDIR}/${PN}.logrotate-${PVR}" "${PN}" + if use syslog ; then + newinitd "${FILESDIR}/${PN}.init.d-${PV}-r6" ntpd + else + newinitd "${FILESDIR}/${PN}.init.d-${PV}-r4" ntpd + insinto /etc/logrotate.d + newins "${FILESDIR}/${PN}.logrotate-${PV}-r5" ntpd + fi + newconfd "${FILESDIR}/${PN}.conf.d-${PV}-r6" ntpd systemd_newunit "${FILESDIR}/${PN}.service-${PV}-r3" ntpd.service } @@ -76,8 +78,11 @@ pkg_postinst() { # remove localtime file from previous installations rm -f "${EROOT}${NTP_HOME}"/etc/localtime mkdir -p "${NTP_HOME}"/etc - ln -s /etc/localtime "${NTP_HOME}"/etc/localtime || die + ln /etc/localtime "${NTP_HOME}"/etc/localtime || die chown -R root:root "${EROOT}${NTP_HOME}" || die + + use syslog && [[ -f ${EROOT}/var/log/ntpd.log ]] && \ + ewarn "There is an orphaned logfile '/var/log/ntpd.log', please remove it!" } pkg_postrm() { |