]>
Commit | Line | Data |
---|---|---|
5af29fb3 MT |
1 | ############################################################################### |
2 | # IPFire.org - An Open Source Firewall Solution # | |
3 | # Copyright (C) - IPFire Development Team <info@ipfire.org> # | |
4 | ############################################################################### | |
5 | ||
6 | name = ntp | |
4579e680 | 7 | version = %{ver_major}.8 |
5af29fb3 | 8 | ver_major = 4.2 |
511f2021 | 9 | release = 4 |
5af29fb3 MT |
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}/ | |
5af29fb3 MT |
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 | ||
9be83326 | 37 | prepare_cmds |
359e71fd SS |
38 | # Create ntp user and group. |
39 | %{create_user} | |
5af29fb3 MT |
40 | end |
41 | ||
42 | configure_options += \ | |
43 | --sysconfdir=%{sysconfdir}/ntp/crypto \ | |
5af29fb3 MT |
44 | --enable-all-clocks \ |
45 | --enable-parse-clocks \ | |
511f2021 SS |
46 | --enable-ntp-signd=%{localstatedir}/run/ntp_signd \ |
47 | --without-rpath | |
5af29fb3 | 48 | |
5af29fb3 MT |
49 | make_install_targets += bindir=%{sbindir} |
50 | ||
51 | install_cmds | |
52 | mkdir -pv %{BUILDROOT}%{mandir}/man{5,8} | |
53 | sed -i "s/sntp\.1/sntp\.8/" %{BUILDROOT}%{mandir}/man1/sntp.1 | |
54 | mv -v %{BUILDROOT}%{mandir}/man{1/sntp.1,8/sntp.8} | |
55 | rm -rfv %{BUILDROOT}%{mandir}/man1 | |
56 | ||
5af29fb3 MT |
57 | # Fix section numbers. |
58 | sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \ | |
59 | %{BUILDROOT}%{mandir}/man8/*.8 | |
60 | ||
61 | mkdir -pv %{BUILDROOT}/%{sysconfdir}/sysconfig | |
62 | mkdir -pv %{BUILDROOT}/%{localstatedir}/{lib/ntp,log/ntpstats} | |
63 | mkdir -pv %{BUILDROOT}%{prefix}/lib | |
64 | touch %{BUILDROOT}/%{localstatedir}/lib/ntp/{drift,sntp-kod} | |
65 | ||
66 | sed \ | |
67 | -e "s@VENDORZONE@%{VENDORZONE}@g" \ | |
68 | -e "s@ETCNTP@%{sysconfdir}/ntp@g" \ | |
69 | -e "s@VARNTP@%{localstatedir}/lib/ntp@g" \ | |
70 | < %{DIR_SOURCE}/ntp.conf > %{BUILDROOT}%{sysconfdir}/ntp.conf | |
71 | ||
72 | mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp | |
73 | sed -e "s@VENDORZONE@%{VENDORZONE}@g" \ | |
74 | < %{DIR_SOURCE}/ntp.step-tickers > %{BUILDROOT}%{sysconfdir}/ntp/step-tickers | |
75 | ||
76 | # Install crypto pw. | |
77 | mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp/crypto | |
78 | install -p -m 600 %{DIR_SOURCE}/ntp.cryptopw \ | |
79 | %{BUILDROOT}%{sysconfdir}/ntp/crypto/pw | |
80 | ||
81 | # Install keys. | |
82 | install -p -m 600 %{DIR_SOURCE}/ntp.keys \ | |
83 | %{BUILDROOT}%{sysconfdir}/ntp/keys | |
84 | ||
85 | # Install ntpdate wrapper. | |
86 | install -p -m 755 %{DIR_SOURCE}/ntpdate-wrapper\ | |
87 | %{BUILDROOT}%{prefix}/lib/ntpdate-wrapper | |
88 | install -p -m 644 %{DIR_SOURCE}/ntpdate.sysconfig \ | |
89 | %{BUILDROOT}%{sysconfdir}/sysconfig/ntpdate | |
90 | ||
91 | mkdir -pv %{unitdir}/ntp-units.d | |
92 | echo "ntpd.service" > %{unitdir}/ntp-units.d/60-ntpd.list | |
359e71fd SS |
93 | |
94 | # Fix ownership. | |
95 | chown -R ntp:ntp %{BUILDROOT}%{sharedstatedir}/ntp | |
5af29fb3 MT |
96 | end |
97 | end | |
98 | ||
359e71fd SS |
99 | create_user |
100 | getent group ntp >/dev/null || groupadd -g 38 ntp || : | |
101 | getent passwd ntp >/dev/null || useradd -u 38 -g 38 -s /sbin/nologin \ | |
102 | -M -r -d %{sysconfdir}/ntp ntp || : | |
103 | end | |
104 | ||
5af29fb3 MT |
105 | packages |
106 | package %{name} | |
aafa4eb8 SS |
107 | groups += Base |
108 | ||
5af29fb3 MT |
109 | requires |
110 | ntpdate = %{thisver} | |
111 | end | |
112 | ||
113 | datafiles | |
114 | %{localstatedir}/lib/ntp/drift | |
115 | end | |
116 | ||
117 | script postin | |
118 | systemctl daemon-reload >/dev/null 2>&1 || : | |
aafa4eb8 | 119 | systemctl --no-reload enable ntpd.service >/dev/null 2>&1 || : |
5af29fb3 MT |
120 | end |
121 | ||
122 | script preun | |
123 | systemctl --no-reload disable ntpd.service >/dev/null 2>&1 || : | |
124 | systemctl stop ntpd.service >/dev/null 2>&1 || : | |
125 | end | |
126 | ||
127 | script postun | |
128 | systemctl daemon-reload >/dev/null 2>&1 || : | |
129 | end | |
130 | ||
131 | script postup | |
132 | systemctl daemon-reload >/dev/null 2>&1 || : | |
133 | systemctl try-restart ntpd.service >/dev/null 2>&1 || : | |
134 | end | |
135 | end | |
136 | ||
137 | package ntpdate | |
138 | summary = Utility to set the date and time via NTP. | |
139 | ||
140 | description | |
141 | ntpdate is a program for retrieving the date and time | |
142 | from NTP servers. | |
143 | end | |
144 | ||
145 | files | |
146 | %{sbindir}/ntpdate | |
147 | %{mandir}/man8/ntpdate.8* | |
148 | end | |
149 | ||
150 | script prein | |
359e71fd | 151 | %{create_user} |
5af29fb3 MT |
152 | end |
153 | ||
154 | script postin | |
155 | systemctl daemon-reload >/dev/null 2>&1 || : | |
156 | end | |
157 | ||
158 | script preun | |
159 | systemctl --no-reload disable ntpdate.service >/dev/null 2>&1 || : | |
160 | systemctl stop ntpdate.service >/dev/null 2>&1 || : | |
161 | end | |
162 | ||
163 | script postun | |
164 | systemctl daemon-reload >/dev/null 2>&1 || : | |
165 | end | |
166 | end | |
167 | ||
5af29fb3 MT |
168 | package %{name}-devel |
169 | template DEVEL | |
170 | end | |
171 | ||
172 | package %{name}-debuginfo | |
173 | template DEBUGINFO | |
174 | end | |
175 | end |