Merge pull request #631 from marineam/ntp

Add ntpd, remove tlsdate
This commit is contained in:
Michael Marineau 2014-05-22 17:40:33 -07:00
commit 2cea022bfd
11 changed files with 224 additions and 1 deletions

View File

@ -117,8 +117,8 @@ RDEPEND="${RDEPEND}
net-firewall/iptables net-firewall/iptables
net-misc/bridge-utils net-misc/bridge-utils
net-misc/dhcpcd net-misc/dhcpcd
net-misc/ntp
net-misc/rsync net-misc/rsync
net-misc/tlsdate
net-misc/wget net-misc/wget
sys-apps/coreutils sys-apps/coreutils
sys-apps/dbus sys-apps/dbus

View File

@ -0,0 +1,2 @@
DIST ntp-4.2.6p5-manpages.tar.bz2 47874 SHA256 f49203cba2301ce27a53113a6e22d844b258114604f2c9ee1371833babc70f9c SHA512 57d4b8fc4482a41c6595418ebff1a861d4bd7ee175b13cf5580a5915749a096b3a906ca8ddf9fc9c57ead783df22b7b9326b51bbab9cd8340576413bee3e7f84 WHIRLPOOL 83c2d95fe953ab2cd7729bc03d89e44a2de85cb68b4ec72c123a034846866aebf7b83eeb4e45add6aa1443f2de83bfbb1ecdbb437534d827d1e1a4a08f91cfd4
DIST ntp-4.2.6p5.tar.gz 4202539 SHA256 d6ab8371f9d31e594eb6922823d5ccd03dcc4e9d84b0e23ea25ac1405432f91c SHA512 8d76fc7e92b2ea6dd5031e6030a7aba4ff6fb3e19d3bc0153852509861be5d0960e70604814163caedb81f8315a451d78371f99634a50b55cfe1cbd2c69e3046 WHIRLPOOL 9943706ad02e377cb38d65caed6f675d37db7aa53dd86319b17405791494bf11244ac933867516cca9438947202b595b6606088a8aaa436655f9eeb8d078b77e

View File

@ -0,0 +1,33 @@
https://support.ntp.org/bugs/show_bug.cgi?id=769
http://bugs.gentoo.org/254030
--- ntp/util/tickadj.c
+++ ntp/util/tickadj.c
@@ -21,7 +21,8 @@
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
-#ifdef HAVE___ADJTIMEX /* Linux */
+/* proper handling here has been moved to upstream ntp bugzilla */
+#ifdef linux
#include <sys/timex.h>
struct timex txc;
@@ -91,7 +92,7 @@
}
if (!errflg) {
- if (__adjtimex(&txc) < 0)
+ if (adjtimex(&txc) < 0)
perror("adjtimex");
else if (!quiet)
printf("tick = %ld\ntick_adj = %d\n",
@@ -146,7 +147,7 @@
#endif
}
- if (__adjtimex(&txc) < 0)
+ if (adjtimex(&txc) < 0)
{
perror("adjtimex");
}

View File

@ -0,0 +1,20 @@
http://bugs.gentoo.org/270483
ripped from fedora
--- ntp-4.2.4p7/include/ntp_syscall.h
+++ ntp-4.2.4p7/include/ntp_syscall.h
@@ -14,5 +14,13 @@
# include <sys/timex.h>
#endif
+#if defined(ADJ_NANO) && !defined(MOD_NANO)
+#define MOD_NANO ADJ_NANO
+#endif
+
+#if defined(ADJ_TAI) && !defined(MOD_TAI)
+#define MOD_TAI ADJ_TAI
+#endif
+
#ifndef NTP_SYSCALLS_LIBC
#ifdef NTP_SYSCALLS_STD

View File

@ -0,0 +1,19 @@
# Common pool
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.
# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore
# Default configuration:
# - Allow only time queries, at a limited rate, sending KoD when in excess.
# - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]

View File

@ -0,0 +1,2 @@
d /var/lib/ntp 0755 ntp ntp - -
L /etc/ntp.conf - - - - /usr/share/ntp/ntp.conf

View File

@ -0,0 +1,10 @@
[Unit]
Description=Network Time Service
After=ntpdate.service sntp.service
[Service]
ExecStart=/usr/sbin/ntpd -g -n -u ntp:ntp -f /var/lib/ntp/ntp.drift
PrivateTmp=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Set time via NTP using ntpdate
After=network.target nss-lookup.target
Before=time-sync.target
Wants=time-sync.target
[Service]
Type=oneshot
Environment="SERVER=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
ExecStart=/usr/sbin/ntpdate -b -u $SERVER
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Set time via SNTP
After=network.target nss-lookup.target
Before=time-sync.target
Wants=time-sync.target
[Service]
Type=oneshot
Environment="SERVER=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
ExecStart=/usr/bin/sntp -s $SERVER
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,109 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/ntp-4.2.6_p5-r10.ebuild,v 1.12 2014/04/06 15:03:40 vapier Exp $
EAPI="4"
inherit eutils toolchain-funcs flag-o-matic user systemd
MY_P=${P/_p/p}
DESCRIPTION="Network Time Protocol suite/programs"
HOMEPAGE="http://www.ntp.org/"
SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz
mirror://gentoo/${MY_P}-manpages.tar.bz2"
LICENSE="HPND BSD ISC"
SLOT="0"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint"
IUSE="caps debug doc examples ipv6 openntpd parse-clocks samba selinux snmp ssl vim-syntax zeroconf"
DEPEND=">=sys-libs/ncurses-5.2
>=sys-libs/readline-4.1
kernel_linux? ( caps? ( sys-libs/libcap ) )
zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
!openntpd? ( !net-misc/openntpd )
snmp? ( net-analyzer/net-snmp )
ssl? ( dev-libs/openssl )
selinux? ( sec-policy/selinux-ntp )
parse-clocks? ( net-misc/pps-tools )"
RDEPEND="${DEPEND}
vim-syntax? ( app-vim/ntp-syntax )"
PDEPEND="openntpd? ( net-misc/openntpd )"
S=${WORKDIR}/${MY_P}
pkg_setup() {
enewgroup ntp 123
enewuser ntp 123 -1 /dev/null ntp
}
src_prepare() {
epatch "${FILESDIR}"/${PN}-4.2.4_p5-adjtimex.patch #254030
epatch "${FILESDIR}"/${PN}-4.2.4_p7-nano.patch #270483
append-cppflags -D_GNU_SOURCE #264109
}
src_configure() {
# avoid libmd5/libelf
export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no
export ac_cv_lib_elf_nlist=no
# blah, no real configure options #176333
export ac_cv_header_dns_sd_h=$(usex zeroconf)
export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h}
econf \
--with-lineeditlibs=readline,edit,editline \
$(use_enable caps linuxcaps) \
$(use_enable parse-clocks) \
$(use_enable ipv6) \
$(use_enable debug debugging) \
$(use_enable samba ntp-signd) \
$(use_with snmp ntpsnmpd) \
$(use_with ssl crypto)
}
src_install() {
default
# move ntpd/ntpdate to sbin #66671
dodir /usr/sbin
mv "${ED}"/usr/bin/{ntpd,ntpdate} "${ED}"/usr/sbin/ || die "move to sbin"
dodoc INSTALL WHERE-TO-START
doman "${WORKDIR}"/man/*.[58]
use doc && dohtml -r html/*
insinto /usr/share/ntp
doins "${FILESDIR}"/ntp.conf
if use examples; then
cp -r scripts/* "${ED}"/usr/share/ntp/ || die
use prefix || fperms -R go-w /usr/share/ntp
find "${ED}"/usr/share/ntp \
'(' \
-name '*.in' -o \
-name 'Makefile*' -o \
-name support \
')' \
-exec rm -r {} \;
fi
keepdir /var/lib/ntp
use prefix || fowners ntp:ntp /var/lib/ntp
systemd_newtmpfilesd "${FILESDIR}"/ntp.tmpfiles ntp.conf
if use openntpd ; then
cd "${ED}"
rm usr/sbin/ntpd || die
rm -r var/lib
rm usr/share/man/*/ntpd.8 || die
else
systemd_dounit "${FILESDIR}"/ntpd.service
systemd_enable_ntpunit 60-ntpd ntpd.service
systemd_enable_service multi-user.target ntpd.service
if ! use caps ; then
sed -i "s|-u ntp:ntp||" \
"${ED}/$(systemd_get_unitdir)/ntpd.service" || die
fi
fi
systemd_dounit "${FILESDIR}"/ntpdate.service
systemd_dounit "${FILESDIR}"/sntp.service
}