initial import
This commit is contained in:
90
ntp/PKGBUILD
Normal file
90
ntp/PKGBUILD
Normal file
@@ -0,0 +1,90 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=ntp
|
||||
_pkgname=ntp #-dev
|
||||
_pkgver=4.2.8p15
|
||||
pkgver=${_pkgver/p/.p}
|
||||
_debver=4.2.8p15
|
||||
_debrel=1
|
||||
pkgrel=1
|
||||
pkgdesc='Network Time Protocol reference implementation'
|
||||
url='http://www.ntp.org/'
|
||||
license=('Simplified-BSD')
|
||||
arch=('i686' 'x86_64')
|
||||
depends=('libressl' 'perl' 'libcap' 'libedit')
|
||||
makedepends=('quilt')
|
||||
optdepends=('logger: message logging support')
|
||||
backup=('etc/ntp.conf'
|
||||
'etc/conf.d/ntpd'
|
||||
'etc/conf.d/ntp-client'
|
||||
'etc/init.d/sntp')
|
||||
source=("https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${_pkgname}-${_pkgver}.tar.gz"
|
||||
"https://deb.debian.org/debian/pool/main/n/ntp/ntp_$_debver+dfsg-$_debrel.debian.tar.xz"
|
||||
'ntp.conf'
|
||||
'libressl-2.8.patch'
|
||||
'ntpd.confd'
|
||||
'ntp-client.confd'
|
||||
'sntp.confd'
|
||||
'ntpd.initd'
|
||||
'ntp-client.initd'
|
||||
'sntp.initd')
|
||||
sha512sums=('f5ad765e45fc302263dd40e94c287698fd235b94f3684e49f1d5d09d7d8bdd6b8c0fb96ecdabffea3d233e1e79b3c9687b76dc204ba76bad3f554682f4a97794'
|
||||
'6fe6603f2c699d65ffa4e49f1c406af9d8b50a97154b157e5111d332ea2d25374fb15813fbbc0d9788b7fa93469c6b768d1371ebc5b6235dd47bbb408b6b55af'
|
||||
'94e801d7a04620bc473f387e20a250b53e7788e287e42081812d47ea47be21a17edd2d3471bd0ad416ce80dccf3788cf93025ced37a1c5984fe072662f427855'
|
||||
'00ff0ce8e824190b12d914518be9653c79d72137e45e10e5e62f835e8d38c7cbb740acc669a0062e9d300f18257169823acd535023f524d77a147a73b5c284ca'
|
||||
'a9e96a214d3c21a3f4863709c48a11f9dedc73e2d83a9b20761021df44a9acb56757e77f113aa0314f5f3923e9cb26bc6e0147658d20e8a74d078d415a171d91'
|
||||
'2d6b9d96c55787cf4556332054a61399368dcf37cf76a14aaba3f8e2e4fdd47ce25808f9babda2ca1f2a6e7387c043e023251ba2b99786426c875bd7cb6592a6'
|
||||
'28c8f1fd3a69bbdfacc2379a3ce01f254ae21fd8b91d893600086d27e5fb9cccf05d1bf62022ab26fcb53fa2080d4178961619811fd7a56f4e7502893f8ea13b'
|
||||
'd51856ebff9160a01e1331114c5a8ea7337f9c8b570da75f36bbb29dcaf1924a40cdbbbf56e03148fc0f540103846e58d15175acf2e9d83c6b68d55c1e199734'
|
||||
'37f4937423cf3f39e7e801bd794ffb6f2a52e995a104e8969a6c373414c05aa31aaa59c2f4d181a4ef00cb22115584131c6e0dce4385b7b652f9e002c585e9fb'
|
||||
'8359d290b90fe9797a15305947a47e1a7731eb30f0d353bc2199c971ccdb190ed5a990df5c04263229791763d4a9e029ebb5af3a19cd8de21c13a67b2ecd9ac1')
|
||||
|
||||
options=('!emptydirs')
|
||||
install=ntp.install
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${_pkgname}-${_pkgver}"
|
||||
|
||||
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
# Doesn't apply and seems unimportant
|
||||
rm -v debian/patches/debian-locfile.patch || true
|
||||
rm -v debian/patches/reproducible-build.patch || true
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
|
||||
patch -p1 -i ../libressl-2.8.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${_pkgname}-${_pkgver}"
|
||||
|
||||
./configure --prefix=/usr --enable-linuxcaps --enable-ntp-signd
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${_pkgname}-${_pkgver}"
|
||||
|
||||
make DESTDIR="${pkgdir}" install
|
||||
|
||||
install -d -m755 "${pkgdir}"/usr/sbin
|
||||
mv "${pkgdir}"/usr/bin/{ntp-keygen,ntp-wait,ntpd,ntpdate,ntptime} "${pkgdir}"/usr/sbin
|
||||
|
||||
install -Dm644 ../ntp.conf "${pkgdir}"/etc/ntp.conf
|
||||
for f in ntpd ntp-client sntp; do
|
||||
install -Dm644 ../$f.confd "${pkgdir}"/etc/conf.d/$f
|
||||
install -Dm755 ../$f.initd "${pkgdir}"/etc/init.d/$f
|
||||
done
|
||||
install -Dm644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/COPYRIGHT"
|
||||
|
||||
install -d -o 87 "${pkgdir}"/var/lib/ntp
|
||||
echo > "${pkgdir}/var/lib/ntp/.placeholder"
|
||||
}
|
||||
40
ntp/libressl-2.8.patch
Normal file
40
ntp/libressl-2.8.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
diff --git a/include/libssl_compat.h b/include/libssl_compat.h
|
||||
index 2a3697c..eeb83d9 100644
|
||||
--- a/include/libssl_compat.h
|
||||
+++ b/include/libssl_compat.h
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
# include <openssl/objects.h>
|
||||
@@ -107,10 +107,13 @@ extern int sslshim_X509_get_signature_nid(const X509 *x);
|
||||
|
||||
#define OpenSSL_version_num SSLeay
|
||||
#define OpenSSL_version SSLeay_version
|
||||
+
|
||||
+# if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L
|
||||
#define X509_get0_notBefore X509_get_notBefore
|
||||
#define X509_getm_notBefore X509_get_notBefore
|
||||
#define X509_get0_notAfter X509_get_notAfter
|
||||
#define X509_getm_notAfter X509_get_notAfter
|
||||
+#endif /* !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L */
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
#endif /* OPENSSL_VERSION_NUMBER < v1.1.0 */
|
||||
diff --git a/libntp/libssl_compat.c b/libntp/libssl_compat.c
|
||||
index 5527682..88a3870 100644
|
||||
--- a/libntp/libssl_compat.c
|
||||
+++ b/libntp/libssl_compat.c
|
||||
@@ -26,7 +26,7 @@
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
+#if defined(OPENSSL) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
#include "libssl_compat.h"
|
||||
21
ntp/ntp-client.confd
Normal file
21
ntp/ntp-client.confd
Normal file
@@ -0,0 +1,21 @@
|
||||
# /etc/conf.d/ntp-client
|
||||
|
||||
# Command to run to set the clock initially
|
||||
# Most people should just leave this line alone ...
|
||||
# however, if you know what you're doing, and you
|
||||
# want to use ntpd to set the clock, change this to 'ntpd'
|
||||
NTPCLIENT_CMD="ntpdate"
|
||||
|
||||
# Options to pass to the above command
|
||||
# This default setting should work fine but you should
|
||||
# change the default 'pool.ntp.org' to something closer
|
||||
# to your machine. See http://www.pool.ntp.org/ or
|
||||
# try running `netselect -s 3 pool.ntp.org`.
|
||||
NTPCLIENT_OPTS="-s -b -u \
|
||||
0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \
|
||||
2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
|
||||
|
||||
# If you use hostnames above, then you should depend on dns
|
||||
# being up & running before we try to run. Otherwise, you
|
||||
# can disable this.
|
||||
rc_use="dns"
|
||||
32
ntp/ntp-client.initd
Normal file
32
ntp/ntp-client.initd
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2013 Gentoo Foundation
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
depend() {
|
||||
before cron portmap
|
||||
after net openvpn
|
||||
use dns logger
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
if ! type "${NTPCLIENT_CMD}" >/dev/null 2>&1 ; then
|
||||
eerror "Please edit /etc/conf.d/ntp-client"
|
||||
eerror "Unable to locate the client command ${NTPCLIENT_CMD}!"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "${NTPCLIENT_OPTS}" ] ; then
|
||||
eerror "Please edit /etc/conf.d/ntp-client"
|
||||
eerror "I need to know what server/options to use!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig || return $?
|
||||
|
||||
ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"
|
||||
"${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS}
|
||||
eend $? "Failed to set clock"
|
||||
}
|
||||
23
ntp/ntp.conf
Normal file
23
ntp/ntp.conf
Normal file
@@ -0,0 +1,23 @@
|
||||
# Please consider joining the pool:
|
||||
#
|
||||
# http://www.pool.ntp.org/join.html
|
||||
#
|
||||
# For additional information see:
|
||||
# - http://support.ntp.org/bin/view/Support/GettingStarted
|
||||
# - the ntp.conf man page
|
||||
|
||||
# Associate to Arch's NTP pool
|
||||
server 0.pool.ntp.org
|
||||
server 1.pool.ntp.org
|
||||
server 2.pool.ntp.org
|
||||
server 3.pool.ntp.org
|
||||
|
||||
# By default, the server allows:
|
||||
# - all queries from the local host
|
||||
# - only time queries from remote hosts, protected by rate limiting and kod
|
||||
restrict default kod limited nomodify nopeer noquery notrap
|
||||
restrict 127.0.0.1
|
||||
restrict ::1
|
||||
|
||||
# Location of drift file
|
||||
driftfile /var/lib/ntp/ntp.drift
|
||||
28
ntp/ntp.install
Normal file
28
ntp/ntp.install
Normal file
@@ -0,0 +1,28 @@
|
||||
post_install() {
|
||||
if ! getent group ntp &>/dev/null; then
|
||||
groupadd -g 87 ntp >/dev/null
|
||||
fi
|
||||
if ! getent passwd ntp &>/dev/null; then
|
||||
useradd -u 87 -g ntp -G adm -d /var/lib/ntp -c 'Network Time Protocol' -s /bin/nologin ntp >/dev/null
|
||||
fi
|
||||
if ! groups ntp | grep adm &>/dev/null; then
|
||||
gpasswd -a ntp adm >/dev/null
|
||||
fi
|
||||
ntp_shell=$(getent passwd ntp | cut -d: -f7)
|
||||
if [ "$ntp_shell" != '/bin/nologin' ]; then
|
||||
chsh -s /bin/nologin ntp &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
post_upgrade(){
|
||||
post_install
|
||||
}
|
||||
|
||||
post_remove(){
|
||||
if getent passwd ntp &>/dev/null; then
|
||||
userdel ntp >/dev/null
|
||||
fi
|
||||
if getent group ntp &>/dev/null; then
|
||||
groupdel ntp >/dev/null
|
||||
fi
|
||||
}
|
||||
6
ntp/ntpd.confd
Normal file
6
ntp/ntpd.confd
Normal file
@@ -0,0 +1,6 @@
|
||||
# /etc/conf.d/ntpd
|
||||
|
||||
# Options to pass to the ntpd process
|
||||
# Most people should leave this line alone ...
|
||||
# however, if you know what you're doing, feel free to tweak
|
||||
NTPD_OPTS="-g -u ntp:ntp"
|
||||
22
ntp/ntpd.initd
Normal file
22
ntp/ntpd.initd
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
description="ntpd - the network time protocol daemon"
|
||||
pidfile="/var/run/ntpd.pid"
|
||||
command="/usr/sbin/ntpd"
|
||||
command_args="-p ${pidfile} ${NTPD_OPTS}"
|
||||
start_stop_daemon_args="--pidfile ${pidfile}"
|
||||
|
||||
depend() {
|
||||
use net dns logger
|
||||
after ntp-client
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ ! -f /etc/ntp.conf ] ; then
|
||||
eerror "Please create /etc/ntp.conf"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
4
ntp/sntp.confd
Normal file
4
ntp/sntp.confd
Normal file
@@ -0,0 +1,4 @@
|
||||
# /etc/conf.d/sntp
|
||||
|
||||
# Options to pass to sntp
|
||||
SNTP_OPTS="-s 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
|
||||
27
ntp/sntp.initd
Normal file
27
ntp/sntp.initd
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Copyright 2018 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
command="/usr/bin/sntp"
|
||||
|
||||
depend() {
|
||||
before cron portmap
|
||||
after net openvpn
|
||||
use dns logger
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ -z "${SNTP_OPTS}" ] ; then
|
||||
eerror "Please edit /etc/conf.d/sntp"
|
||||
eerror "I need to know what server/options to use!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Setting clock via SNTP"
|
||||
${command} ${SNTP_OPTS}
|
||||
eend $? "Failed to set clock"
|
||||
}
|
||||
Reference in New Issue
Block a user