]> git.ipfire.org Git - people/pmueller/ipfire-3.x.git/blob - ntp/ntp.nm
ntp: Remove ntpstat
[people/pmueller/ipfire-3.x.git] / ntp / ntp.nm
1 ###############################################################################
2 # IPFire.org - An Open Source Firewall Solution #
3 # Copyright (C) - IPFire Development Team <info@ipfire.org> #
4 ###############################################################################
5
6 name = ntp
7 version = %{ver_major}.8
8 ver_major = 4.2
9 release = 3
10
11 groups = System/Daemons
12 url = http://www.ntp.org/
13 license = (MIT and BSD and BSD with advertising) and GPLv2
14 summary = The NTP daemon and utilities.
15
16 description
17 The Network Time Protocol (NTP) is used to synchronize a computer's
18 time with another reference time source. This package includes ntpd
19 (a daemon which continuously adjusts system time) and utilities used
20 to query and configure the ntpd daemon.
21 end
22
23 source_dl = http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-%{ver_major}/
24
25 # The vendor part in the NTP pool address.
26 VENDORZONE = %{DISTRO_SNAME}
27
28 build
29 requires
30 libcap-devel
31 libedit-devel
32 openssl-devel
33 perl-HTML-Parser
34 pps-tools-devel
35 end
36
37 prepare_cmds
38 # Create ntp user and group.
39 %{create_user}
40 end
41
42 configure_options += \
43 --sysconfdir=%{sysconfdir}/ntp/crypto \
44 --enable-all-clocks \
45 --enable-parse-clocks \
46 --enable-ntp-signd=%{localstatedir}/run/ntp_signd
47
48 make_install_targets += bindir=%{sbindir}
49
50 install_cmds
51 mkdir -pv %{BUILDROOT}%{mandir}/man{5,8}
52 sed -i "s/sntp\.1/sntp\.8/" %{BUILDROOT}%{mandir}/man1/sntp.1
53 mv -v %{BUILDROOT}%{mandir}/man{1/sntp.1,8/sntp.8}
54 rm -rfv %{BUILDROOT}%{mandir}/man1
55
56 # Fix section numbers.
57 sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \
58 %{BUILDROOT}%{mandir}/man8/*.8
59
60 mkdir -pv %{BUILDROOT}/%{sysconfdir}/sysconfig
61 mkdir -pv %{BUILDROOT}/%{localstatedir}/{lib/ntp,log/ntpstats}
62 mkdir -pv %{BUILDROOT}%{prefix}/lib
63 touch %{BUILDROOT}/%{localstatedir}/lib/ntp/{drift,sntp-kod}
64
65 sed \
66 -e "s@VENDORZONE@%{VENDORZONE}@g" \
67 -e "s@ETCNTP@%{sysconfdir}/ntp@g" \
68 -e "s@VARNTP@%{localstatedir}/lib/ntp@g" \
69 < %{DIR_SOURCE}/ntp.conf > %{BUILDROOT}%{sysconfdir}/ntp.conf
70
71 mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp
72 sed -e "s@VENDORZONE@%{VENDORZONE}@g" \
73 < %{DIR_SOURCE}/ntp.step-tickers > %{BUILDROOT}%{sysconfdir}/ntp/step-tickers
74
75 # Install crypto pw.
76 mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp/crypto
77 install -p -m 600 %{DIR_SOURCE}/ntp.cryptopw \
78 %{BUILDROOT}%{sysconfdir}/ntp/crypto/pw
79
80 # Install keys.
81 install -p -m 600 %{DIR_SOURCE}/ntp.keys \
82 %{BUILDROOT}%{sysconfdir}/ntp/keys
83
84 # Install ntpdate wrapper.
85 install -p -m 755 %{DIR_SOURCE}/ntpdate-wrapper\
86 %{BUILDROOT}%{prefix}/lib/ntpdate-wrapper
87 install -p -m 644 %{DIR_SOURCE}/ntpdate.sysconfig \
88 %{BUILDROOT}%{sysconfdir}/sysconfig/ntpdate
89
90 mkdir -pv %{unitdir}/ntp-units.d
91 echo "ntpd.service" > %{unitdir}/ntp-units.d/60-ntpd.list
92
93 # Fix ownership.
94 chown -R ntp:ntp %{BUILDROOT}%{sharedstatedir}/ntp
95 end
96 end
97
98 create_user
99 getent group ntp >/dev/null || groupadd -g 38 ntp || :
100 getent passwd ntp >/dev/null || useradd -u 38 -g 38 -s /sbin/nologin \
101 -M -r -d %{sysconfdir}/ntp ntp || :
102 end
103
104 packages
105 package %{name}
106 groups += Base
107
108 requires
109 ntpdate = %{thisver}
110 end
111
112 datafiles
113 %{localstatedir}/lib/ntp/drift
114 end
115
116 script postin
117 systemctl daemon-reload >/dev/null 2>&1 || :
118 systemctl --no-reload enable ntpd.service >/dev/null 2>&1 || :
119 end
120
121 script preun
122 systemctl --no-reload disable ntpd.service >/dev/null 2>&1 || :
123 systemctl stop ntpd.service >/dev/null 2>&1 || :
124 end
125
126 script postun
127 systemctl daemon-reload >/dev/null 2>&1 || :
128 end
129
130 script postup
131 systemctl daemon-reload >/dev/null 2>&1 || :
132 systemctl try-restart ntpd.service >/dev/null 2>&1 || :
133 end
134 end
135
136 package ntpdate
137 summary = Utility to set the date and time via NTP.
138
139 description
140 ntpdate is a program for retrieving the date and time
141 from NTP servers.
142 end
143
144 files
145 %{sbindir}/ntpdate
146 %{mandir}/man8/ntpdate.8*
147 end
148
149 script prein
150 %{create_user}
151 end
152
153 script postin
154 systemctl daemon-reload >/dev/null 2>&1 || :
155 end
156
157 script preun
158 systemctl --no-reload disable ntpdate.service >/dev/null 2>&1 || :
159 systemctl stop ntpdate.service >/dev/null 2>&1 || :
160 end
161
162 script postun
163 systemctl daemon-reload >/dev/null 2>&1 || :
164 end
165 end
166
167 package %{name}-devel
168 template DEVEL
169 end
170
171 package %{name}-debuginfo
172 template DEBUGINFO
173 end
174 end