From 739c65c54cb0e957df5e9b76f93fb02554e5cac3 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 4 May 2022 23:52:30 +0100 Subject: moved everything to new file formatting --- repo/system/openntpd/libtls-standalone.patch | 20 ++++++++++++ repo/system/openntpd/ntp-user.patch | 13 ++++++++ repo/system/openntpd/openntpd.confd | 3 ++ repo/system/openntpd/openntpd.initd | 14 ++++++++ repo/system/openntpd/openntpd.xibuild | 49 ++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 repo/system/openntpd/libtls-standalone.patch create mode 100644 repo/system/openntpd/ntp-user.patch create mode 100644 repo/system/openntpd/openntpd.confd create mode 100644 repo/system/openntpd/openntpd.initd create mode 100644 repo/system/openntpd/openntpd.xibuild (limited to 'repo/system/openntpd') diff --git a/repo/system/openntpd/libtls-standalone.patch b/repo/system/openntpd/libtls-standalone.patch new file mode 100644 index 0000000..3b5d8e4 --- /dev/null +++ b/repo/system/openntpd/libtls-standalone.patch @@ -0,0 +1,20 @@ +diff --git a/configure.ac b/configure.ac +index 88884c2..b0c0697 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -60,8 +60,13 @@ AM_CONDITIONAL([HAVE_CLOCK_GETRES], [test "x$ac_cv_func_clock_getres" = xyes]) + AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "x$ac_cv_func_clock_gettime" = xyes]) + + # check for libtls +-AC_SEARCH_LIBS([tls_config_set_ca_mem],[tls], +- [LIBS="$LIBS -ltls -lssl -lcrypto"],,[-lssl -lcrypto]) ++PKG_CHECK_MODULES([LIBTLS], [libtls],[],[ ++ PKG_CHECK_MODULES([LIBTLS], [libtls-standalone]) ++ ]) ++AC_SEARCH_LIBS([tls_config_set_ca_mem],[tls tls-standalone], ++ [LIBS="$LIBS $LIBTLS_LIBS" ++ CFLAGS="$CFLAGS $LIBTLS_CFLAGS"], ++ ,[$LIBTLS_LIBS]) + AC_CHECK_FUNCS([tls_config_set_ca_mem]) + + # check if libtls uses 3-argument tls_write diff --git a/repo/system/openntpd/ntp-user.patch b/repo/system/openntpd/ntp-user.patch new file mode 100644 index 0000000..200676c --- /dev/null +++ b/repo/system/openntpd/ntp-user.patch @@ -0,0 +1,13 @@ +diff --git a/src/ntpd.h b/src/ntpd.h +index 6403391..cc41d42 100644 +--- a/src/ntpd.h ++++ b/src/ntpd.h +@@ -37,7 +37,7 @@ + #define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) + + #ifndef NTPD_USER +-#define NTPD_USER "_ntp" ++#define NTPD_USER "ntp" + #endif + + #ifndef SYSCONFDIR diff --git a/repo/system/openntpd/openntpd.confd b/repo/system/openntpd/openntpd.confd new file mode 100644 index 0000000..ec002b7 --- /dev/null +++ b/repo/system/openntpd/openntpd.confd @@ -0,0 +1,3 @@ +# See ntpd(8) man page ... some popular options: +# -s Set the time immediately at startup +#NTPD_OPTS= diff --git a/repo/system/openntpd/openntpd.initd b/repo/system/openntpd/openntpd.initd new file mode 100644 index 0000000..dc9a9ae --- /dev/null +++ b/repo/system/openntpd/openntpd.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run + +name="NTP Server" +command=/usr/sbin/ntpd +command_args="-d $NTPD_OPTS" +command_background=yes +pidfile=/run/$RC_SVCNAME.pid +required_files=/etc/ntpd.conf + +depend() { + need net + provide ntp-client + use dns logger +} diff --git a/repo/system/openntpd/openntpd.xibuild b/repo/system/openntpd/openntpd.xibuild new file mode 100644 index 0000000..5dfd7e9 --- /dev/null +++ b/repo/system/openntpd/openntpd.xibuild @@ -0,0 +1,49 @@ +#!/bin/sh + +NAME="openntpd" +DESC="Lightweight NTP server ported from OpenBSD" + +MAKEDEPS="make " +DEPS="libretls " + +PKG_VER=6.8p1 +SOURCE="https://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/openntpd-$PKG_VER.tar.gz" +ADDITIONAL="libtls-standalone.patch ntp-user.patch +openntpd.confd +openntpd.initd +" + +prepare () { + apply_patches + autoreconf -vif +} + +build () { + ./configure \ + --prefix=/usr \ + --bindir=/usr/bin \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --disable-static \ + --enable-https-constraint \ + --with-privsep-user=ntp + make +} + +package () { + make DESTDIR=$PKG_DEST install + + mkdir -p "$PKG_DEST/var/empty" + install -Dm755 "openntpd.initd" $PKG_DEST/etc/init.d/openntpd + install -Dm755 "openntpd.confd" $PKG_DEST/etc/conf.d/openntpd +} + +postinstall () { + + /usr/sbin/groupadd -fg 129 ntp && + /usr/sbin/useradd -c "ntp daemon owner" -d /var/lib/ntp -u 117 \ + -g ntp -s /bin/false ntp + + rc-update add openntpd +} -- cgit v1.2.1