1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | |
---|
5 | name chrony |
---|
6 | version 3.2 |
---|
7 | categories sysutils net |
---|
8 | license GPL-2 |
---|
9 | platforms darwin |
---|
10 | maintainers @ldldr openmaintainer |
---|
11 | |
---|
12 | description Chrony is a versatile implementation of the \ |
---|
13 | Network Time Protocol (NTP) |
---|
14 | long_description Chrony can synchronize the system clock with NTP \ |
---|
15 | servers, reference clocks, and manual input. It can also operate \ |
---|
16 | as an NTPv4 (RFC 5905) server and peer to provide a time service \ |
---|
17 | to other computers in the network. \ |
---|
18 | It is designed to perform well in a wide range of conditions, \ |
---|
19 | including intermittent network connections, heavily congested \ |
---|
20 | networks, changing temperatures (ordinary computer clocks are \ |
---|
21 | sensitive to temperature), and systems that do not run \ |
---|
22 | continuosly, or run on a virtual machine. |
---|
23 | |
---|
24 | homepage https://chrony.tuxfamily.org/ |
---|
25 | master_sites http://download.tuxfamily.org/chrony/ |
---|
26 | checksums rmd160 c25f7e84cd82940631bc0a1c7abfb71e7a797e21 \ |
---|
27 | sha256 329f6718dd8c3ece3eee78be1f4821cbbeb62608e7d23f25da293cfa433c4116 \ |
---|
28 | size 433882 |
---|
29 | |
---|
30 | depends_lib port:readline |
---|
31 | |
---|
32 | configure.args --sysconfdir=${prefix}/etc \ |
---|
33 | --localstatedir=${prefix}/var \ |
---|
34 | --with-sendmail=/usr/sbin/sendmail \ |
---|
35 | --with-pidfile=${prefix}/var/run/${name}/chronyd.pid |
---|
36 | |
---|
37 | post-build { |
---|
38 | # This creates the helper application, chrony-netchanged, which monitors |
---|
39 | # the network state and switches chronyd on when an internet link comes up |
---|
40 | # and off when it goes down. |
---|
41 | system -W ${worksrcpath} "${configure.cc} ${configure.cflags} [get_canonical_archflags cc] \ |
---|
42 | -DPREFIX=\\\"${prefix}\\\" -framework CoreFoundation -framework SystemConfiguration \ |
---|
43 | -o chrony-netchanged ${filespath}/chrony-netchanged.c" |
---|
44 | } |
---|
45 | |
---|
46 | post-destroot { |
---|
47 | xinstall -m 755 ${worksrcpath}/chrony-netchanged ${destroot}${prefix}/sbin/chrony-netchanged |
---|
48 | |
---|
49 | xinstall -m 755 -d ${destroot}${prefix}/etc/${name} |
---|
50 | xinstall -m 0644 ${filespath}/${name}.conf.in \ |
---|
51 | ${destroot}${prefix}/etc/${name}/${name}.conf-dist |
---|
52 | reinplace "s|@PREFIX@|${prefix}|" ${destroot}${prefix}/etc/${name}/${name}.conf-dist |
---|
53 | xinstall -m 0755 ${filespath}/${name}-netchange.in \ |
---|
54 | ${destroot}${prefix}/etc/${name}/${name}-netchange |
---|
55 | reinplace "s|@PREFIX@|${prefix}|" ${destroot}${prefix}/etc/${name}/${name}-netchange |
---|
56 | |
---|
57 | xinstall -m 770 -g wheel -d ${destroot}${prefix}/var/run/${name} |
---|
58 | } |
---|
59 | |
---|
60 | destroot.keepdirs ${destroot}${prefix}/var/run/${name} |
---|
61 | |
---|
62 | post-activate { |
---|
63 | if {![file exists ${prefix}/etc/${name}/${name}.conf]} { |
---|
64 | file copy ${prefix}/etc/${name}/${name}.conf-dist ${prefix}/etc/${name}/${name}.conf |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | startupitem.create yes |
---|
69 | startupitem.pidfile auto ${prefix}/var/run/${name}/chronyd.pid |
---|
70 | |
---|
71 | # Start chronyd and chrony-netchanged and monitor the reachability |
---|
72 | # of the first NTP server found in chrony.conf: |
---|
73 | startupitem.start \ |
---|
74 | "${prefix}/sbin/chronyd -r -s -f ${prefix}/etc/${name}/${name}.conf |
---|
75 | sleep 2 |
---|
76 | target=\$(test -f ${prefix}/etc/${name}/${name}.conf && awk '/^\s*(pool|server)/ {print \$2; exit}' ${prefix}/etc/${name}/${name}.conf) |
---|
77 | if ! ( \[ -e ${prefix}/var/run/chrony-netchanged.pid \] && kill -0 \$(cat ${prefix}/var/run/chrony-netchanged.pid) 2>/dev/null ) ; then |
---|
78 | ${prefix}/sbin/chrony-netchanged \$target & |
---|
79 | /bin/echo -n \$! > ${prefix}/var/run/${name}/chrony-netchanged.pid |
---|
80 | fi" |
---|
81 | |
---|
82 | startupitem.stop \ |
---|
83 | "/bin/kill \$(cat ${prefix}/var/run/${name}/chronyd.pid) |
---|
84 | /bin/kill \$(cat ${prefix}/var/run/${name}/chrony-netchanged.pid) |
---|
85 | /bin/rm -f ${prefix}/var/run/${name}/chrony-netchanged.pid" |
---|
86 | |
---|
87 | livecheck.type regex |
---|
88 | livecheck.url ${homepage}download.html |
---|
89 | livecheck.regex {chrony-(\d+\.\d+(\.\d+)?)} |
---|