]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blame - ntp/ntp.nm
smartmontools: update to 6.5
[people/amarx/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
4579e680 7version = %{ver_major}.8
5af29fb3 8ver_major = 4.2
aafa4eb8 9release = 2
5af29fb3
MT
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}
359e71fd
SS
44
45 # Create ntp user and group.
46 %{create_user}
5af29fb3
MT
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
5af29fb3
MT
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
359e71fd
SS
119
120 # Fix ownership.
121 chown -R ntp:ntp %{BUILDROOT}%{sharedstatedir}/ntp
5af29fb3
MT
122 end
123end
124
359e71fd
SS
125create_user
126 getent group ntp >/dev/null || groupadd -g 38 ntp || :
127 getent passwd ntp >/dev/null || useradd -u 38 -g 38 -s /sbin/nologin \
128 -M -r -d %{sysconfdir}/ntp ntp || :
129end
130
5af29fb3
MT
131packages
132 package %{name}
aafa4eb8
SS
133 groups += Base
134
5af29fb3
MT
135 requires
136 ntpdate = %{thisver}
137 end
138
139 datafiles
140 %{localstatedir}/lib/ntp/drift
141 end
142
143 script postin
144 systemctl daemon-reload >/dev/null 2>&1 || :
aafa4eb8 145 systemctl --no-reload enable ntpd.service >/dev/null 2>&1 || :
5af29fb3
MT
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
359e71fd 177 %{create_user}
5af29fb3
MT
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
5af29fb3
MT
194 package %{name}-devel
195 template DEVEL
196 end
197
198 package %{name}-debuginfo
199 template DEBUGINFO
200 end
201end