]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - ntp/ntp.nm
9c8bb566698de4e88b2f04e072e094fb86e71be9
[people/ms/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}.6p5
8 ver_major = 4.2
9 release = 2
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 sources += ntpstat-0.2.tgz
25
26 # The vendor part in the NTP pool address.
27 VENDORZONE = %{DISTRO_SNAME}
28
29 build
30 requires
31 libcap-devel
32 libedit-devel
33 openssl-devel
34 perl-HTML-Parser
35 pps-tools-devel
36 end
37
38 prepare
39 %{MACRO_EXTRACT_TARBALL}
40
41 ln -svf ../ntpstat-0.2 .
42
43 %{MACRO_PATCHES}
44
45 # Create ntp user and group.
46 %{create_user}
47 end
48
49 configure_options += \
50 --sysconfdir=%{sysconfdir}/ntp/crypto \
51 --with-openssl-libdir=%{libdir} \
52 --enable-all-clocks \
53 --enable-parse-clocks \
54 --enable-ntp-signd=%{localstatedir}/run/ntp_signd
55
56 build
57 ./configure %{configure_options}
58
59 echo "#define KEYFILE \"%{sysconfdir}/ntp/keys\"" >> ntpdate/ntpdate.h
60 echo "#define NTP_VAR \"%{localstatedir}/log/ntpstats/\"" >> config.h
61
62 make ${PARALLELISMFLAGS}
63
64 sed -i 's|$ntpq = "ntpq"|$ntpq = "%{sbindir}/ntpq"|' scripts/ntptrace
65 sed -i 's|ntpq -c |%{sbindir}/ntpq -c |' scripts/ntp-wait
66
67 # Build ntpstat.
68 make -C ntpstat-0.2
69 end
70
71 make_install_targets += bindir=%{sbindir}
72
73 install_cmds
74 mkdir -pv %{BUILDROOT}%{mandir}/man{5,8}
75 sed -i "s/sntp\.1/sntp\.8/" %{BUILDROOT}%{mandir}/man1/sntp.1
76 mv -v %{BUILDROOT}%{mandir}/man{1/sntp.1,8/sntp.8}
77 rm -rfv %{BUILDROOT}%{mandir}/man1
78
79 # Install ntpstat.
80 pushd ntpstat-0.2
81 mkdir -pv %{BUILDROOT}%{bindir}
82 install -m 755 ntpstat %{BUILDROOT}%{bindir}
83 install -m 644 ntpstat.1 %{BUILDROOT}%{mandir}/man8/ntpstat.8
84 popd
85
86 # Fix section numbers.
87 sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \
88 %{BUILDROOT}%{mandir}/man8/*.8
89
90 mkdir -pv %{BUILDROOT}/%{sysconfdir}/sysconfig
91 mkdir -pv %{BUILDROOT}/%{localstatedir}/{lib/ntp,log/ntpstats}
92 mkdir -pv %{BUILDROOT}%{prefix}/lib
93 touch %{BUILDROOT}/%{localstatedir}/lib/ntp/{drift,sntp-kod}
94
95 sed \
96 -e "s@VENDORZONE@%{VENDORZONE}@g" \
97 -e "s@ETCNTP@%{sysconfdir}/ntp@g" \
98 -e "s@VARNTP@%{localstatedir}/lib/ntp@g" \
99 < %{DIR_SOURCE}/ntp.conf > %{BUILDROOT}%{sysconfdir}/ntp.conf
100
101 mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp
102 sed -e "s@VENDORZONE@%{VENDORZONE}@g" \
103 < %{DIR_SOURCE}/ntp.step-tickers > %{BUILDROOT}%{sysconfdir}/ntp/step-tickers
104
105 # Install crypto pw.
106 mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp/crypto
107 install -p -m 600 %{DIR_SOURCE}/ntp.cryptopw \
108 %{BUILDROOT}%{sysconfdir}/ntp/crypto/pw
109
110 # Install keys.
111 install -p -m 600 %{DIR_SOURCE}/ntp.keys \
112 %{BUILDROOT}%{sysconfdir}/ntp/keys
113
114 # Install ntpdate wrapper.
115 install -p -m 755 %{DIR_SOURCE}/ntpdate-wrapper\
116 %{BUILDROOT}%{prefix}/lib/ntpdate-wrapper
117 install -p -m 644 %{DIR_SOURCE}/ntpdate.sysconfig \
118 %{BUILDROOT}%{sysconfdir}/sysconfig/ntpdate
119
120 mkdir -pv %{unitdir}/ntp-units.d
121 echo "ntpd.service" > %{unitdir}/ntp-units.d/60-ntpd.list
122
123 # Fix ownership.
124 chown -R ntp:ntp %{BUILDROOT}%{sharedstatedir}/ntp
125 end
126 end
127
128 create_user
129 getent group ntp >/dev/null || groupadd -g 38 ntp || :
130 getent passwd ntp >/dev/null || useradd -u 38 -g 38 -s /sbin/nologin \
131 -M -r -d %{sysconfdir}/ntp ntp || :
132 end
133
134 packages
135 package %{name}
136 requires
137 ntpdate = %{thisver}
138 end
139
140 datafiles
141 %{localstatedir}/lib/ntp/drift
142 end
143
144 script postin
145 systemctl daemon-reload >/dev/null 2>&1 || :
146 end
147
148 script preun
149 systemctl --no-reload disable ntpd.service >/dev/null 2>&1 || :
150 systemctl stop ntpd.service >/dev/null 2>&1 || :
151 end
152
153 script postun
154 systemctl daemon-reload >/dev/null 2>&1 || :
155 end
156
157 script postup
158 systemctl daemon-reload >/dev/null 2>&1 || :
159 systemctl try-restart ntpd.service >/dev/null 2>&1 || :
160 end
161 end
162
163 package ntpdate
164 summary = Utility to set the date and time via NTP.
165
166 description
167 ntpdate is a program for retrieving the date and time
168 from NTP servers.
169 end
170
171 files
172 %{sbindir}/ntpdate
173 %{mandir}/man8/ntpdate.8*
174 end
175
176 script prein
177 %{create_user}
178 end
179
180 script postin
181 systemctl daemon-reload >/dev/null 2>&1 || :
182 end
183
184 script preun
185 systemctl --no-reload disable ntpdate.service >/dev/null 2>&1 || :
186 systemctl stop ntpdate.service >/dev/null 2>&1 || :
187 end
188
189 script postun
190 systemctl daemon-reload >/dev/null 2>&1 || :
191 end
192 end
193
194 package %{name}-perl
195 summary = NTP utilities written in Perl.
196 description
197 This package contains Perl scripts ntp-wait and ntptrace.
198 end
199 groups = Applications/System
200
201 requires
202 %{name} = %{thisver}
203 end
204
205 files
206 %{sbindir}/ntp-wait
207 %{sbindir}/ntptrace
208 %{mandir}/man8/ntp-wait.8*
209 %{mandir}/man8/ntptrace.8*
210 %{unitdir}/ntp-wait.service
211 end
212
213 script preun
214 systemctl --no-reload disable ntp-wait.service >/dev/null 2>&1 || :
215 systemctl stop ntp-wait.service >/dev/null 2>&1 || :
216 end
217
218 script postun
219 systemctl daemon-reload >/dev/null 2>&1 || :
220 end
221
222 script postup
223 systemctl daemon-reload >/dev/null 2>&1 || :
224 end
225 end
226
227 package %{name}-devel
228 template DEVEL
229 end
230
231 package %{name}-debuginfo
232 template DEBUGINFO
233 end
234 end