blob: dd3530f7f7af826a91a1dcd97ad74f73ffbdaa6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
|