diff options
Diffstat (limited to 'opt/openntpd/MAKEPKG')
| -rw-r--r-- | opt/openntpd/MAKEPKG | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/opt/openntpd/MAKEPKG b/opt/openntpd/MAKEPKG new file mode 100644 index 0000000..dd3530f --- /dev/null +++ b/opt/openntpd/MAKEPKG @@ -0,0 +1,96 @@ +#!/bin/mkpkg +# description: Free, easy to use NTP implementation from OpenBSD +# url: https://www.openntpd.org + +name=openntpd +version=7.9p1 +release=5 +depends=(libressl) +groups=(ntp:user:ntp:/var/empty:755:902:902) +services=(ntpd) +permissions=( + /var/empty:root:root:755 + /etc/ntpd.conf:root:root:644 +) +source=(https://cdn.openbsd.org/pub/OpenBSD/OpenNTPD/$name-$version.tar.gz) + +sha256sums=( + "091eeb3f4e358e28c3ab2ea58f93d7a0b5758a20d7c8a0418e162e9b2c27addc" +) + +patch() { + cd $name-$version + + # musl: no /etc/services so getservbyname("ntp","udp") returns NULL + # and fatal() fires immediately. Two-file fix: + # + # 1. ntp.c: remove the fatal() guard so NULL se is allowed to pass through + # 2. server.c: replace both se->s_port dereferences with htons(123) + + sed -i '/if ((se = getservbyname("ntp", "udp")) == NULL)/{n; s/.*fatal.*//;}' \ + src/ntp.c + + sed -i 's/se->s_port/htons(123)/g' \ + src/server.c +} + +build() { + cd $name-$version + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --with-privsep-user=ntp \ + --with-cacert=/etc/ssl/cert.pem + make + make DESTDIR=$PKG install +} + +post_build() { + cd $name-$version + + # ntpd.conf — pool.ntp.org with HTTPS constraints + printf '%s\n' \ + '# krypt ntpd.conf' \ + '' \ + 'servers pool.ntp.org' \ + '' \ + '# HTTPS time constraint validation (requires libtls)' \ + 'constraints from "https://www.google.com/search?q=openntpd"' \ + > $PKG/etc/ntpd.conf + + # runit service + # ntpd manages its own privilege separation — runs as root, + # forks an unprivileged child as ntp. + # -s removed: deprecated and fatal in 6.8p1; use constraints instead. + install -d $PKG/etc/sv/ntpd/log + + printf '%s\n' \ + '#!/bin/sh' \ + 'exec 2>&1' \ + 'exec ntpd -d' \ + > $PKG/etc/sv/ntpd/run + + printf '%s\n' \ + '#!/bin/sh' \ + 'rm -f /var/run/ntpd.sock' \ + > $PKG/etc/sv/ntpd/finish + + printf '%s\n' \ + '#!/bin/sh' \ + 'mkdir -p /var/log/ntpd' \ + 'exec svlogd -tt /var/log/ntpd' \ + > $PKG/etc/sv/ntpd/log/run + + chmod 755 $PKG/etc/sv/ntpd/run + chmod 755 $PKG/etc/sv/ntpd/finish + chmod 755 $PKG/etc/sv/ntpd/log/run + +} + +signify() { + untrusted comment: public key + RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3 +} + +# vim: filetype=sh |
