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