blob: 0e2306e71e342d7f33dc94eed75bae8539b262c4 [file] [log] [blame]
pauledd7c242003-06-04 13:59:38 +00001# configure options
paulb64d92a2005-04-25 15:13:42 +00002#
3# Some can be overriden on rpmbuild commandline with:
4# rpmbuild --define 'variable value'
Martin Wintera5efdb62015-10-29 22:15:42 -07005# (use any value, ie 1 for flag "with_XXXX" definitions)
paulb64d92a2005-04-25 15:13:42 +00006#
Paul Jakma283d5d72016-02-11 13:54:23 +00007# E.g. rpmbuild --define 'release_rev 02' may be useful if building
8# rpms again and again on the same day, so the newer rpms can be installed.
9# bumping the number each time.
paulb64d92a2005-04-25 15:13:42 +000010
paul11890752005-11-05 16:29:54 +000011####################### Quagga configure options #########################
12# with-feature options
Martin Wintera5efdb62015-10-29 22:15:42 -070013%{!?with_snmp: %global with_snmp 1 }
14%{!?with_vtysh: %global with_vtysh 1 }
15%{!?with_tcp_zebra: %global with_tcp_zebra 0 }
16%{!?with_vtysh: %global with_vtysh 1 }
17%{!?with_pam: %global with_pam 1 }
18%{!?with_ospfclient: %global with_ospfclient 1 }
19%{!?with_ospfapi: %global with_ospfapi 1 }
20%{!?with_irdp: %global with_irdp 1 }
21%{!?with_rtadv: %global with_rtadv 1 }
22%{!?with_isisd: %global with_isisd 1 }
23%{!?with_pimd: %global with_pimd 1 }
Timo Teräs2d78fe72017-02-14 13:07:39 +020024%{!?with_nhrpd: %global with_nhrpd 1 }
Martin Wintera5efdb62015-10-29 22:15:42 -070025%{!?with_shared: %global with_shared 1 }
26%{!?with_multipath: %global with_multipath 64 }
27%{!?quagga_user: %global quagga_user quagga }
28%{!?vty_group: %global vty_group quaggavt }
29%{!?with_fpm: %global with_fpm 0 }
30%{!?with_watchquagga: %global with_watchquagga 1 }
paul30b9d892003-01-18 22:57:15 +000031
32# path defines
paul6bd8fd32003-08-12 12:54:13 +000033%define _sysconfdir /etc/quagga
Martin Wintera5efdb62015-10-29 22:15:42 -070034%define zeb_src %{_builddir}/%{name}-%{quaggaversion}
paul8f754982003-01-20 04:55:51 +000035%define zeb_rh_src %{zeb_src}/redhat
36%define zeb_docs %{zeb_src}/doc
paul788cdc62003-01-18 00:22:08 +000037
paule0626852003-03-18 14:11:36 +000038# defines for configure
paul6bd8fd32003-08-12 12:54:13 +000039%define _localstatedir /var/run/quagga
paul11890752005-11-05 16:29:54 +000040############################################################################
41
Martin Wintera5efdb62015-10-29 22:15:42 -070042#### Version String tweak
43# Remove invalid characters form version string and replace with _
44%{expand: %%define rpmversion %(echo '@VERSION@' | tr [:blank:]- _ )}
45%define quaggaversion @VERSION@
paul11890752005-11-05 16:29:54 +000046
Martin Wintera5efdb62015-10-29 22:15:42 -070047#### Check version of texi2html
48# Old versions don't support "--number-footnotes" option.
Paul Jakma9e31fbc2017-02-27 17:43:44 +000049%{expand: %%global texi2htmlversion %(type texi2html >/dev/null 2>&1 && (rpm -q --qf '%%{VERSION}' texi2html | cut -d. -f1) || echo 0 )}
paul11890752005-11-05 16:29:54 +000050
Martin Wintera5efdb62015-10-29 22:15:42 -070051#### Check for systemd or init.d (upstart)
52# Check for init.d (upstart) as used in CentOS 6 or systemd (ie CentOS 7)
53%{expand: %%global initsystem %(if [[ `/sbin/init --version 2> /dev/null` =~ upstart ]]; then echo upstart; elif [[ `systemctl` =~ -\.mount ]]; then echo systemd; fi)}
54#
55# If init system is systemd, then always disable watchquagga
56#
57%if "%{initsystem}" == "systemd"
58 # Note: For systems with systemd, watchquagga will NOT be built. Systemd
59 # takes over the role of restarting crashed processes. Value will
60 # be overwritten with 0 below for systemd independent on the setting here
61 %global with_watchquagga 0
62%endif
paul11890752005-11-05 16:29:54 +000063
Martin Wintera5efdb62015-10-29 22:15:42 -070064# if FPM is enabled, then enable tcp_zebra as well
65#
66%if %{with_fpm}
67 %global with_tcp_zebra 1
68%endif
paule0626852003-03-18 14:11:36 +000069
paul15d74e92003-12-30 11:16:21 +000070# misc internal defines
paulb64d92a2005-04-25 15:13:42 +000071%{!?quagga_uid: %define quagga_uid 92 }
72%{!?quagga_gid: %define quagga_gid 92 }
Martin Wintera5efdb62015-10-29 22:15:42 -070073%{!?vty_gid: %define vty_gid 85 }
74
paul54b25dc2004-09-30 04:56:26 +000075%define daemon_list zebra ripd ospfd bgpd
paul0df63b52004-11-07 22:12:23 +000076
David Lamparter5460bae2015-05-19 00:35:04 +020077%define daemonv6_list ripngd ospf6d
paul0df63b52004-11-07 22:12:23 +000078
paul54b25dc2004-09-30 04:56:26 +000079%if %{with_isisd}
Martin Wintera5efdb62015-10-29 22:15:42 -070080%define daemon_isisd isisd
paul69f5d262004-10-07 16:23:36 +000081%else
Martin Wintera5efdb62015-10-29 22:15:42 -070082%define daemon_isisd ""
paul15d74e92003-12-30 11:16:21 +000083%endif
84
Martin Wintera5efdb62015-10-29 22:15:42 -070085%if %{with_pimd}
86%define daemon_pimd pimd
87%else
88%define daemon_pimd ""
89%endif
90
Timo Teräs2d78fe72017-02-14 13:07:39 +020091%if %{with_nhrpd}
92%define daemon_nhrpd nhrpd
93%else
94%define daemon_nhrpd ""
95%endif
96
Martin Wintera5efdb62015-10-29 22:15:42 -070097%if %{with_watchquagga}
98%define daemon_watchquagga watchquagga
99%else
100%define daemon_watchquagga ""
101%endif
102
Timo Teräs2d78fe72017-02-14 13:07:39 +0200103%define all_daemons %{daemon_list} %{daemonv6_list} %{daemon_isisd} %{daemon_pimd} %{daemon_nhrpd} %{daemon_watchquagga}
ajsb3324e22004-12-22 17:52:29 +0000104
paulb5f310c2004-09-13 13:15:25 +0000105# allow build dir to be kept
Martin Wintera5efdb62015-10-29 22:15:42 -0700106%{!?keep_build: %global keep_build 0 }
paulb5f310c2004-09-13 13:15:25 +0000107
paul4859e202005-11-20 02:09:32 +0000108#release sub-revision (the two digits after the CONFDATE)
109%{!?release_rev: %define release_rev 01 }
110
paul788cdc62003-01-18 00:22:08 +0000111Summary: Routing daemon
Martin Wintera5efdb62015-10-29 22:15:42 -0700112Name: quagga
113Version: %{rpmversion}
114Release: @CONFDATE@%{release_rev}%{?dist}
115License: GPLv2+
116Group: System Environment/Daemons
Paul Jakma93687462017-02-27 22:42:59 +0000117Source0: https://download.savannah.gnu.org/releases/quagga/%{name}-%{quaggaversion}.tar.gz
118URL: https://www.quagga.net
Martin Wintera5efdb62015-10-29 22:15:42 -0700119Requires: ncurses
120Requires(pre): /sbin/install-info
121Requires(preun): /sbin/install-info
122Requires(post): /sbin/install-info
123BuildRequires: texi2html texinfo autoconf patch libcap-devel groff
Paul Jakma4cdc0302017-03-03 15:07:28 +0000124BuildRequires: perl-generators pkgconfig
paul54b25dc2004-09-30 04:56:26 +0000125%if %{with_snmp}
paulb63cef72004-08-19 03:36:13 +0000126BuildRequires: net-snmp-devel
Martin Wintera5efdb62015-10-29 22:15:42 -0700127Requires: net-snmp
paul788cdc62003-01-18 00:22:08 +0000128%endif
paul54b25dc2004-09-30 04:56:26 +0000129%if %{with_vtysh}
paul30b9d892003-01-18 22:57:15 +0000130BuildRequires: readline readline-devel ncurses ncurses-devel
Martin Wintera5efdb62015-10-29 22:15:42 -0700131Requires: ncurses
pauld7ccae22003-01-18 00:24:00 +0000132%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700133%if %{with_pam}
134BuildRequires: pam-devel
135Requires: pam
136%endif
Paul Jakma4cdc0302017-03-03 15:07:28 +0000137%if %{with_nhrpd}
138BuildRequires: c-ares-devel
139Requires: c-ares
140%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700141%if "%{initsystem}" == "systemd"
142BuildRequires: systemd
143Requires(post): systemd
144Requires(preun): systemd
145Requires(postun): systemd
146%else
paul788cdc62003-01-18 00:22:08 +0000147# Initscripts > 5.60 is required for IPv6 support
Matti-Oskari Leppänenfa755852013-02-15 10:12:55 +0000148Requires(pre): initscripts >= 5.60
Martin Wintera5efdb62015-10-29 22:15:42 -0700149%endif
150Provides: routingdaemon = %{version}-%{release}
151BuildRoot: %{_tmppath}/%{name}-%{version}-root
Paul Jakma93687462017-02-27 22:42:59 +0000152Obsoletes: mrt zebra quagga-sysvinit
153
154%define __perl_requires %{zeb_rh_src}/quagga-filter-perl-requires.sh
paul788cdc62003-01-18 00:22:08 +0000155
156%description
Paul Jakma93687462017-02-27 22:42:59 +0000157Quagga is a free software routing protocol suite.
paul788cdc62003-01-18 00:22:08 +0000158
Paul Jakma93687462017-02-27 22:42:59 +0000159Quagga supports BGP, OSPFv2, OSPFv3, ISIS, RIP, RIPng, PIM-SSM and NHRP.
paul788cdc62003-01-18 00:22:08 +0000160
paul448ed4a2003-03-01 15:43:28 +0000161%package contrib
paul6bd8fd32003-08-12 12:54:13 +0000162Summary: contrib tools for quagga
paul448ed4a2003-03-01 15:43:28 +0000163Group: System Environment/Daemons
164
165%description contrib
paul6bd8fd32003-08-12 12:54:13 +0000166Contributed/3rd party tools which may be of use with quagga.
paul448ed4a2003-03-01 15:43:28 +0000167
paule0626852003-03-18 14:11:36 +0000168%package devel
paul6bd8fd32003-08-12 12:54:13 +0000169Summary: Header and object files for quagga development
paule0626852003-03-18 14:11:36 +0000170Group: System Environment/Daemons
Martin Wintera5efdb62015-10-29 22:15:42 -0700171Requires: %{name} = %{version}-%{release}
paule0626852003-03-18 14:11:36 +0000172
173%description devel
paul6bd8fd32003-08-12 12:54:13 +0000174The quagga-devel package contains the header and object files neccessary for
175developing OSPF-API and quagga applications.
paule0626852003-03-18 14:11:36 +0000176
paul788cdc62003-01-18 00:22:08 +0000177%prep
Martin Wintera5efdb62015-10-29 22:15:42 -0700178%setup -q -n quagga-%{quaggaversion}
paul788cdc62003-01-18 00:22:08 +0000179
180%build
ajs7966b972004-11-10 22:02:05 +0000181
182# For standard gcc verbosity, uncomment these lines:
183#CFLAGS="%{optflags} -Wall -Wsign-compare -Wpointer-arith"
184#CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
185
186# For ultra gcc verbosity, uncomment these lines also:
187#CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
188#CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
189#CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
190#CFLAGS="${CFLAGS} -Wpacked -Wpadded"
191
paul788cdc62003-01-18 00:22:08 +0000192%configure \
Martin Wintera5efdb62015-10-29 22:15:42 -0700193 --sysconfdir=%{_sysconfdir} \
Paul Jakma93687462017-02-27 22:42:59 +0000194 --libdir=%{_libdir}/quagga \
Martin Wintera5efdb62015-10-29 22:15:42 -0700195 --libexecdir=%{_libexecdir} \
196 --localstatedir=%{_localstatedir} \
197 --disable-werror \
paul54b25dc2004-09-30 04:56:26 +0000198%if !%{with_shared}
199 --disable-shared \
200%endif
paul54b25dc2004-09-30 04:56:26 +0000201%if %{with_snmp}
paul788cdc62003-01-18 00:22:08 +0000202 --enable-snmp \
203%endif
paul54b25dc2004-09-30 04:56:26 +0000204%if %{with_multipath}
205 --enable-multipath=%{with_multipath} \
paul788cdc62003-01-18 00:22:08 +0000206%endif
paul54b25dc2004-09-30 04:56:26 +0000207%if %{with_tcp_zebra}
paul788cdc62003-01-18 00:22:08 +0000208 --enable-tcp-zebra \
209%endif
paul54b25dc2004-09-30 04:56:26 +0000210%if %{with_vtysh}
paul788cdc62003-01-18 00:22:08 +0000211 --enable-vtysh \
212%endif
paul54b25dc2004-09-30 04:56:26 +0000213%if %{with_ospfclient}
paul68980082003-03-25 05:07:42 +0000214 --enable-ospfclient=yes \
215%else
216 --enable-ospfclient=no\
217%endif
paul54b25dc2004-09-30 04:56:26 +0000218%if %{with_ospfapi}
paul68980082003-03-25 05:07:42 +0000219 --enable-ospfapi=yes \
220%else
221 --enable-ospfapi=no \
222%endif
paul54b25dc2004-09-30 04:56:26 +0000223%if %{with_irdp}
paul5b819262004-07-28 14:11:55 +0000224 --enable-irdp=yes \
225%else
226 --enable-irdp=no \
227%endif
paule7cd37b2005-09-08 15:18:39 +0000228%if %{with_rtadv}
229 --enable-rtadv=yes \
230%else
231 --enable-rtadv=no \
232%endif
paul54b25dc2004-09-30 04:56:26 +0000233%if %{with_isisd}
234 --enable-isisd \
235%else
paul69f5d262004-10-07 16:23:36 +0000236 --disable-isisd \
paul54b25dc2004-09-30 04:56:26 +0000237%endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200238%if %{with_nhrpd}
239 --enable-nhrpd \
240%else
241 --disable-nhrpd \
242%endif
paul54b25dc2004-09-30 04:56:26 +0000243%if %{with_pam}
pauledd7c242003-06-04 13:59:38 +0000244 --with-libpam \
paul788cdc62003-01-18 00:22:08 +0000245%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700246%if 0%{?quagga_user:1}
paul6bd8fd32003-08-12 12:54:13 +0000247 --enable-user=%quagga_user \
248 --enable-group=%quagga_user \
pauledd7c242003-06-04 13:59:38 +0000249%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700250%if 0%{?vty_group:1}
pauledd7c242003-06-04 13:59:38 +0000251 --enable-vty-group=%vty_group \
252%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700253%if %{with_fpm}
254 --enable-fpm \
255%else
256 --disable-fpm \
257%endif
258%if %{with_watchquagga}
259 --enable-watchquagga \
260%else
261 --disable-watchquagga \
262%endif
263 --enable-gcc-rdynamic
paul788cdc62003-01-18 00:22:08 +0000264
265make %{?_smp_mflags} MAKEINFO="makeinfo --no-split"
266
267pushd doc
Martin Wintera5efdb62015-10-29 22:15:42 -0700268%if %{texi2htmlversion} < 5
269texi2html --number-sections quagga.texi
270%else
Paul Jakmae07068c2015-09-04 14:25:13 +0100271texi2html --number-footnotes --number-sections quagga.texi
Martin Wintera5efdb62015-10-29 22:15:42 -0700272%endif
paul788cdc62003-01-18 00:22:08 +0000273popd
274
275%install
Martin Wintera5efdb62015-10-29 22:15:42 -0700276mkdir -p %{buildroot}/etc/{quagga,sysconfig,logrotate.d,pam.d} \
277 %{buildroot}/var/log/quagga %{buildroot}%{_infodir}
278make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" install
paul788cdc62003-01-18 00:22:08 +0000279
paul9a344b72003-08-05 23:24:58 +0000280# Remove this file, as it is uninstalled and causes errors when building on RH9
Martin Wintera5efdb62015-10-29 22:15:42 -0700281rm -rf %{buildroot}/usr/share/info/dir
paul9a344b72003-08-05 23:24:58 +0000282
Martin Wintera5efdb62015-10-29 22:15:42 -0700283# install /etc sources
284%if "%{initsystem}" == "systemd"
285mkdir -p %{buildroot}%{_unitdir}
286for daemon in %{all_daemons} ; do
287 if [ x"${daemon}" != x"" ] ; then
288 install %{zeb_rh_src}/${daemon}.service \
289 %{buildroot}%{_unitdir}/${daemon}.service
290 fi
291done
292%else
293mkdir -p %{buildroot}/etc/rc.d/init.d
ajsb3324e22004-12-22 17:52:29 +0000294for daemon in %{all_daemons} ; do
paulda29c6b2004-10-08 00:49:09 +0000295 if [ x"${daemon}" != x"" ] ; then
296 install %{zeb_rh_src}/${daemon}.init \
Martin Wintera5efdb62015-10-29 22:15:42 -0700297 %{buildroot}/etc/rc.d/init.d/${daemon}
paulda29c6b2004-10-08 00:49:09 +0000298 fi
paul15d74e92003-12-30 11:16:21 +0000299done
Martin Wintera5efdb62015-10-29 22:15:42 -0700300%endif
301
Paul Jakma283d5d72016-02-11 13:54:23 +0000302install -m644 %{zeb_rh_src}/quagga.pam \
Martin Wintera5efdb62015-10-29 22:15:42 -0700303 %{buildroot}/etc/pam.d/quagga
paul15d74e92003-12-30 11:16:21 +0000304install -m644 %{zeb_rh_src}/quagga.logrotate \
Martin Wintera5efdb62015-10-29 22:15:42 -0700305 %{buildroot}/etc/logrotate.d/quagga
paul15d74e92003-12-30 11:16:21 +0000306install -m644 %{zeb_rh_src}/quagga.sysconfig \
Martin Wintera5efdb62015-10-29 22:15:42 -0700307 %{buildroot}/etc/sysconfig/quagga
308install -d -m750 %{buildroot}/var/run/quagga
pauledd7c242003-06-04 13:59:38 +0000309
Paul Jakma93687462017-02-27 22:42:59 +0000310
311%if 0%{?_tmpfilesdir:1}
312 install -d -m 755 %{buildroot}/%{_tmpfilesdir}
313 install -p -m 644 %{zeb_rh_src}/quagga-tmpfs.conf \
314 %{buildroot}/%{_tmpfilesdir}/quagga.conf
315%endif
316
pauledd7c242003-06-04 13:59:38 +0000317%pre
318# add vty_group
Martin Wintera5efdb62015-10-29 22:15:42 -0700319%if 0%{?vty_group:1}
paule7cd37b2005-09-08 15:18:39 +0000320if getent group %vty_group > /dev/null ; then : ; else \
Martin Wintera5efdb62015-10-29 22:15:42 -0700321 /usr/sbin/groupadd -r -g %vty_gid %vty_group > /dev/null || : ; fi
pauledd7c242003-06-04 13:59:38 +0000322%endif
paule7cd37b2005-09-08 15:18:39 +0000323
paul6bd8fd32003-08-12 12:54:13 +0000324# add quagga user and group
Martin Wintera5efdb62015-10-29 22:15:42 -0700325%if 0%{?quagga_user:1}
paule7cd37b2005-09-08 15:18:39 +0000326# Ensure that quagga_gid gets correctly allocated
327if getent group %quagga_user >/dev/null; then : ; else \
328 /usr/sbin/groupadd -g %quagga_gid %quagga_user > /dev/null || : ; \
329fi
330if getent passwd %quagga_user >/dev/null ; then : ; else \
Timo Schöler2e0fb0e2017-02-23 13:16:42 +0000331 /usr/sbin/useradd -u %quagga_uid -g %quagga_gid -G %vty_group \
paule7cd37b2005-09-08 15:18:39 +0000332 -M -r -s /sbin/nologin -c "Quagga routing suite" \
333 -d %_localstatedir %quagga_user 2> /dev/null || : ; \
334fi
pauledd7c242003-06-04 13:59:38 +0000335%endif
paul788cdc62003-01-18 00:22:08 +0000336
paul788cdc62003-01-18 00:22:08 +0000337%post
paul30b9d892003-01-18 22:57:15 +0000338# zebra_spec_add_service <service name> <port/proto> <comment>
paul788cdc62003-01-18 00:22:08 +0000339# e.g. zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
340
341zebra_spec_add_service ()
342{
343 # Add port /etc/services entry if it isn't already there
paul6b637e92004-10-23 00:48:51 +0000344 if [ -f /etc/services ] && \
345 ! %__sed -e 's/#.*$//' /etc/services | %__grep -wq $1 ; then
paul788cdc62003-01-18 00:22:08 +0000346 echo "$1 $2 # $3" >> /etc/services
347 fi
348}
349
350zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
351zebra_spec_add_service zebra 2601/tcp "zebra vty"
352zebra_spec_add_service ripd 2602/tcp "RIPd vty"
353zebra_spec_add_service ripngd 2603/tcp "RIPngd vty"
354zebra_spec_add_service ospfd 2604/tcp "OSPFd vty"
355zebra_spec_add_service bgpd 2605/tcp "BGPd vty"
356zebra_spec_add_service ospf6d 2606/tcp "OSPF6d vty"
paul54b25dc2004-09-30 04:56:26 +0000357%if %{with_ospfapi}
paul7021c422003-07-15 12:52:22 +0000358zebra_spec_add_service ospfapi 2607/tcp "OSPF-API"
359%endif
paul54b25dc2004-09-30 04:56:26 +0000360%if %{with_isisd}
jardin5a514b12003-12-23 10:50:21 +0000361zebra_spec_add_service isisd 2608/tcp "ISISd vty"
paul54b25dc2004-09-30 04:56:26 +0000362%endif
Everton Marques871dbcf2009-08-11 15:43:05 -0300363%if %{with_pimd}
364zebra_spec_add_service pimd 2611/tcp "PIMd vty"
365%endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200366%if %{with_nhrpd}
367zebra_spec_add_service nhrpd 2612/tcp "NHRPd vty"
368%endif
paul788cdc62003-01-18 00:22:08 +0000369
Martin Wintera5efdb62015-10-29 22:15:42 -0700370%if "%{initsystem}" == "systemd"
371for daemon in %all_daemons ; do
372 %systemd_post ${daemon}.service
373done
374%else
375for daemon in %all_daemons ; do
paul15d74e92003-12-30 11:16:21 +0000376 /sbin/chkconfig --add ${daemon}
377done
Martin Wintera5efdb62015-10-29 22:15:42 -0700378%endif
paul788cdc62003-01-18 00:22:08 +0000379
Paul Jakma93687462017-02-27 22:42:59 +0000380if [ -f %{_infodir}/%{name}.inf* ]; then
381 /sbin/install-info %{_infodir}/quagga.info %{_infodir}/dir
382fi
paul788cdc62003-01-18 00:22:08 +0000383
384# Create dummy files if they don't exist so basic functions can be used.
385if [ ! -e %{_sysconfdir}/zebra.conf ]; then
386 echo "hostname `hostname`" > %{_sysconfdir}/zebra.conf
Martin Wintera5efdb62015-10-29 22:15:42 -0700387%if 0%{?quagga_user:1}
388 chown %quagga_user:%quagga_user %{_sysconfdir}/zebra.conf*
paule7cd37b2005-09-08 15:18:39 +0000389%endif
paul788cdc62003-01-18 00:22:08 +0000390 chmod 640 %{_sysconfdir}/zebra.conf
391fi
Martin Wintera5efdb62015-10-29 22:15:42 -0700392for daemon in %{all_daemons} ; do
393 if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then
394 touch %{_sysconfdir}/${daemon}.conf
395 %if 0%{?quagga_user:1}
396 chown %quagga_user:%quagga_user %{_sysconfdir}/${daemon}.conf*
397 %endif
398 fi
399done
400%if %{with_watchquagga}
401 # No config for watchquagga - this is part of /etc/sysconfig/quagga
402 rm -f %{_sysconfdir}/watchquagga.*
403%endif
404
paul788cdc62003-01-18 00:22:08 +0000405if [ ! -e %{_sysconfdir}/vtysh.conf ]; then
406 touch %{_sysconfdir}/vtysh.conf
407 chmod 640 %{_sysconfdir}/vtysh.conf
Martin Wintera5efdb62015-10-29 22:15:42 -0700408%if 0%{?vty_group:1}
409 chown quagga:%{vty_group} %{_sysconfdir}/vtysh.conf*
410%endif
paul788cdc62003-01-18 00:22:08 +0000411fi
412
413%postun
ajsfc43ecc2005-01-12 16:41:33 +0000414if [ "$1" -ge 1 ]; then
415 # Find out which daemons need to be restarted.
ajsb3324e22004-12-22 17:52:29 +0000416 for daemon in %all_daemons ; do
Martin Wintera5efdb62015-10-29 22:15:42 -0700417 if [ -f /var/lock/subsys/${daemon} ]; then
418 eval restart_${daemon}=yes
ajsfc43ecc2005-01-12 16:41:33 +0000419 else
Martin Wintera5efdb62015-10-29 22:15:42 -0700420 eval restart_${daemon}=no
ajsfc43ecc2005-01-12 16:41:33 +0000421 fi
paul15d74e92003-12-30 11:16:21 +0000422 done
ajsfc43ecc2005-01-12 16:41:33 +0000423 # Rename restart flags for daemons handled specially.
424 running_zebra="$restart_zebra"
425 restart_zebra=no
Martin Wintera5efdb62015-10-29 22:15:42 -0700426 %if %{with_watchquagga}
427 running_watchquagga="$restart_watchquagga"
428 restart_watchquagga=no
429 %endif
430
431 %if "%{initsystem}" == "systemd"
432 ##
433 ## Systemd Version
434 ##
435 # No watchquagga for systemd version
436 #
437 # Stop all daemons other than zebra.
438 for daemon in %all_daemons ; do
439 eval restart=\$restart_${daemon}
440 [ "$restart" = yes ] && \
Paul Jakma93687462017-02-27 22:42:59 +0000441 %systemd_postun_with_restart ${daemon}.service
Martin Wintera5efdb62015-10-29 22:15:42 -0700442 done
443 # Restart zebra.
444 [ "$running_zebra" = yes ] && \
445 %systemd_postun_with_restart $daemon.service
446 # Start all daemons other than zebra.
447 for daemon in %all_daemons ; do
448 eval restart=\$restart_${daemon}
449 [ "$restart" = yes ] && \
450 %systemd_post ${daemon}.service
451 done
452 %else
453 ##
454 ## init.d Version
455 ##
456 %if %{with_watchquagga}
457 # Stop watchquagga first.
458 [ "$running_watchquagga" = yes ] && \
459 /etc/rc.d/init.d/watchquagga stop >/dev/null 2>&1
460 %endif
461 # Stop all daemons other than zebra and watchquagga.
462 for daemon in %all_daemons ; do
463 eval restart=\$restart_${daemon}
464 [ "$restart" = yes ] && \
465 /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
466 done
467 # Restart zebra.
468 [ "$running_zebra" = yes ] && \
469 /etc/rc.d/init.d/zebra restart >/dev/null 2>&1
470 # Start all daemons other than zebra and watchquagga.
471 for daemon in %all_daemons ; do
472 eval restart=\$restart_${daemon}
473 [ "$restart" = yes ] && \
474 /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1
475 done
476 %if %{with_watchquagga}
477 # Start watchquagga last.
478 # Avoid postun scriptlet error if watchquagga is not running.
479 [ "$running_watchquagga" = yes ] && \
480 /etc/rc.d/init.d/watchquagga start >/dev/null 2>&1 || :
481 %endif
482 %endif
paul788cdc62003-01-18 00:22:08 +0000483fi
paul788cdc62003-01-18 00:22:08 +0000484
Paul Jakma93687462017-02-27 22:42:59 +0000485if [ -f %{_infodir}/%{name}.inf* ]; then
486 /sbin/install-info --delete %{_infodir}/quagga.info %{_infodir}/dir
487fi
488
paul788cdc62003-01-18 00:22:08 +0000489%preun
Martin Wintera5efdb62015-10-29 22:15:42 -0700490%if "%{initsystem}" == "systemd"
491 ##
492 ## Systemd Version
493 ##
494 if [ "$1" = "0" ]; then
495 for daemon in %all_daemons ; do
496 %systemd_preun ${daemon}.service
497 done
498 fi
499%else
500 ##
501 ## init.d Version
502 ##
503 if [ "$1" = "0" ]; then
504 for daemon in %all_daemons ; do
505 /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
506 /sbin/chkconfig --del ${daemon}
507 done
508 fi
509%endif
paul788cdc62003-01-18 00:22:08 +0000510
511%clean
Martin Wintera5efdb62015-10-29 22:15:42 -0700512%if !0%{?keep_build:1}
513rm -rf %{buildroot}
paulb5f310c2004-09-13 13:15:25 +0000514%endif
paul788cdc62003-01-18 00:22:08 +0000515
516%files
517%defattr(-,root,root)
paul448ed4a2003-03-01 15:43:28 +0000518%doc */*.sample* AUTHORS COPYING
paul6bd8fd32003-08-12 12:54:13 +0000519%doc doc/quagga.html
paul30b9d892003-01-18 22:57:15 +0000520%doc doc/mpls
paul8f754982003-01-20 04:55:51 +0000521%doc ChangeLog INSTALL NEWS README REPORTING-BUGS SERVICES TODO
Martin Wintera5efdb62015-10-29 22:15:42 -0700522%if 0%{?quagga_user:1}
paul6bd8fd32003-08-12 12:54:13 +0000523%dir %attr(751,%quagga_user,%quagga_user) %{_sysconfdir}
524%dir %attr(750,%quagga_user,%quagga_user) /var/log/quagga
525%dir %attr(751,%quagga_user,%quagga_user) /var/run/quagga
pauledd7c242003-06-04 13:59:38 +0000526%else
paul788cdc62003-01-18 00:22:08 +0000527%dir %attr(750,root,root) %{_sysconfdir}
paul6bd8fd32003-08-12 12:54:13 +0000528%dir %attr(750,root,root) /var/log/quagga
paul6bd8fd32003-08-12 12:54:13 +0000529%dir %attr(750,root,root) /var/run/quagga
pauledd7c242003-06-04 13:59:38 +0000530%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700531%if 0%{?vty_group:1}
paul6bd8fd32003-08-12 12:54:13 +0000532%attr(750,%quagga_user,%vty_group) %{_sysconfdir}/vtysh.conf.sample
pauledd7c242003-06-04 13:59:38 +0000533%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700534%{_infodir}/quagga.info.gz
paul788cdc62003-01-18 00:22:08 +0000535%{_mandir}/man*/*
Paul Jakma93687462017-02-27 22:42:59 +0000536%if %{with_watchquagga}
537 %{_mandir}/man*/watchquagga.*
538%endif
paul54b25dc2004-09-30 04:56:26 +0000539%{_sbindir}/zebra
540%{_sbindir}/ospfd
541%{_sbindir}/ripd
542%{_sbindir}/bgpd
Martin Wintera5efdb62015-10-29 22:15:42 -0700543%if %{with_watchquagga}
544 %{_sbindir}/watchquagga
545%endif
paul54b25dc2004-09-30 04:56:26 +0000546%{_sbindir}/ripngd
547%{_sbindir}/ospf6d
Paul Jakma283d5d72016-02-11 13:54:23 +0000548%if %{with_pimd}
549%{_sbindir}/pimd
paul54b25dc2004-09-30 04:56:26 +0000550%endif
551%if %{with_isisd}
552%{_sbindir}/isisd
553%endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200554%if %{with_nhrpd}
555%{_sbindir}/nhrpd
556%endif
paul28f79722004-10-29 05:35:43 +0000557%if %{with_shared}
Paul Jakma93687462017-02-27 22:42:59 +0000558%{_libdir}/quagga/lib*.so
559%{_libdir}/quagga/lib*.so.?
560%attr(755,root,root) %{_libdir}/quagga/lib*.so.?.?.?
paul54b25dc2004-09-30 04:56:26 +0000561%endif
562%if %{with_vtysh}
paul788cdc62003-01-18 00:22:08 +0000563%{_bindir}/*
pauld7ccae22003-01-18 00:24:00 +0000564%endif
paul6bd8fd32003-08-12 12:54:13 +0000565%config /etc/quagga/[!v]*
Martin Wintera5efdb62015-10-29 22:15:42 -0700566%if "%{initsystem}" == "systemd"
Paul Jakma93687462017-02-27 22:42:59 +0000567 %{_unitdir}/*.service
Martin Wintera5efdb62015-10-29 22:15:42 -0700568%else
569 %config /etc/rc.d/init.d/zebra
570 %if %{with_watchquagga}
571 %config /etc/rc.d/init.d/watchquagga
572 %endif
573 %config /etc/rc.d/init.d/ripd
574 %config /etc/rc.d/init.d/ospfd
575 %config /etc/rc.d/init.d/bgpd
576 %config /etc/rc.d/init.d/ripngd
577 %config /etc/rc.d/init.d/ospf6d
578 %if %{with_isisd}
579 %config /etc/rc.d/init.d/isisd
580 %endif
581 %if %{with_pimd}
582 %config /etc/rc.d/init.d/pimd
583 %endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200584 %if %{with_nhrpd}
585 %config /etc/rc.d/init.d/nhrpd
586 %endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700587%endif
paul15d74e92003-12-30 11:16:21 +0000588%config(noreplace) /etc/sysconfig/quagga
paul6bd8fd32003-08-12 12:54:13 +0000589%config(noreplace) /etc/pam.d/quagga
paul788cdc62003-01-18 00:22:08 +0000590%config(noreplace) %attr(640,root,root) /etc/logrotate.d/*
Paul Jakma93687462017-02-27 22:42:59 +0000591%{_tmpfilesdir}/quagga.conf
paul788cdc62003-01-18 00:22:08 +0000592
paul448ed4a2003-03-01 15:43:28 +0000593%files contrib
594%defattr(-,root,root)
Paul Jakma93687462017-02-27 22:42:59 +0000595%doc AUTHORS COPYING %attr(0644,root,root) tools
paul448ed4a2003-03-01 15:43:28 +0000596
paule0626852003-03-18 14:11:36 +0000597%files devel
598%defattr(-,root,root)
Paul Jakma93687462017-02-27 22:42:59 +0000599%doc AUTHORS COPYING
paulda29c6b2004-10-08 00:49:09 +0000600%if %{with_ospfclient}
601%{_sbindir}/ospfclient
602%endif
Paul Jakma93687462017-02-27 22:42:59 +0000603%dir %{_libdir}/quagga/
604%{_libdir}/quagga/*.a
605%{_libdir}/quagga/*.la
paulcfc18422004-10-23 00:05:41 +0000606%dir %attr(755,root,root) %{_includedir}/%{name}
paul28f79722004-10-29 05:35:43 +0000607%{_includedir}/%name/*.h
paulcfc18422004-10-23 00:05:41 +0000608%dir %attr(755,root,root) %{_includedir}/%{name}/ospfd
paul28f79722004-10-29 05:35:43 +0000609%{_includedir}/%name/ospfd/*.h
paul54b25dc2004-09-30 04:56:26 +0000610%if %{with_ospfapi}
paulcfc18422004-10-23 00:05:41 +0000611%dir %attr(755,root,root) %{_includedir}/%{name}/ospfapi
paul28f79722004-10-29 05:35:43 +0000612%{_includedir}/%name/ospfapi/*.h
paul68980082003-03-25 05:07:42 +0000613%endif
paule0626852003-03-18 14:11:36 +0000614
paul788cdc62003-01-18 00:22:08 +0000615%changelog
Paul Jakma93687462017-02-27 22:42:59 +0000616* Mon Feb 27 2017 Paul Jakma <paul@jakma.org> - %{version}
617- Apply 0001-systemd-various-service-file-improvements.patch from Fedora
618- Review Fedora spec file and sync up with any useful differences, inc:
619- Add tmpfiles.d config for Quagga from Fedora
620- Add quagga-filter-perl-requires.sh from Fedora.
621- Move libs to %{_libdir}/quagga as per Fedora
622- use systemd_postun_with_restart for postun
623
Timo Teräs2d78fe72017-02-14 13:07:39 +0200624* Tue Feb 14 2017 Timo Teräs <timo.teras@iki.fi> - %{version}
625- add nhrpd
626
627* Thu Feb 11 2016 Paul Jakma <paul@jakma.org>
Paul Jakma283d5d72016-02-11 13:54:23 +0000628- remove with_ipv6 conditionals, always build v6
629- Fix UTF-8 char in spec changelog
630- remove quagga.pam.stack, long deprecated.
631
Martin Wintera5efdb62015-10-29 22:15:42 -0700632* Thu Oct 22 2015 Martin Winter <mwinter@opensourcerouting.org>
633- Cleanup configure: remove --enable-ipv6 (default now), --enable-nssa,
634 --enable-netlink
635- Remove support for old fedora 4/5
636- Fix for package nameing
637- Fix Weekdays of previous changelogs (bogus dates)
638- Add conditional logic to only build tex footnotes with supported texi2html
639- Added pimd to files section and fix double listing of /var/lib*/quagga
640- Numerous fixes to unify upstart/systemd startup into same spec file
641- Only allow use of watchquagga for non-systemd systems. no need with systemd
642
643* Fri Sep 4 2015 Paul Jakma <paul@jakma.org>
Paul Jakmae07068c2015-09-04 14:25:13 +0100644- buildreq updates
645- add a default define for with_pimd
646
Martin Wintera5efdb62015-10-29 22:15:42 -0700647* Mon Sep 12 2005 Paul Jakma <paul@dishone.st>
paule7cd37b2005-09-08 15:18:39 +0000648- Steal some changes from Fedora spec file:
649- Add with_rtadv variable
650- Test for groups/users with getent before group/user adding
651- Readline need not be an explicit prerequisite
652- install-info delete should be postun, not preun
653
ajsfc43ecc2005-01-12 16:41:33 +0000654* Wed Jan 12 2005 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
655- on package upgrade, implement careful, phased restart logic
656- use gcc -rdynamic flag when linking for better backtraces
657
ajsb3324e22004-12-22 17:52:29 +0000658* Wed Dec 22 2004 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
ajsf3931752004-12-23 00:00:58 +0000659- daemonv6_list should contain only IPv6 daemons
660
661* Wed Dec 22 2004 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
ajsb3324e22004-12-22 17:52:29 +0000662- watchquagga added
663- on upgrade, all daemons should be condrestart'ed
664- on removal, all daemons should be stopped
665
paul36002ae2004-11-08 17:36:29 +0000666* Mon Nov 08 2004 Paul Jakma <paul@dishone.st>
667- Use makeinfo --html to generate quagga.html
668
paul0df63b52004-11-07 22:12:23 +0000669* Sun Nov 07 2004 Paul Jakma <paul@dishone.st>
670- Fix with_ipv6 set to 0 build
671
paulcfc18422004-10-23 00:05:41 +0000672* Sat Oct 23 2004 Paul Jakma <paul@dishone.st>
673- Update to 0.97.2
674
675* Sat Oct 23 2004 Andrew J. Schorr <aschorr@telemetry-investments.com>
676- Make directories be owned by the packages concerned
677- Update logrotate scripts to use correct path to killall and use pid files
678
paulda29c6b2004-10-08 00:49:09 +0000679* Fri Oct 08 2004 Paul Jakma <paul@dishone.st>
680- Update to 0.97.0
681
paul54b25dc2004-09-30 04:56:26 +0000682* Wed Sep 15 2004 Paul Jakma <paul@dishone.st>
683- build snmp support by default
684- build irdp support
685- build with shared libs
686- devel subpackage for archives and headers
687
paul00bc5602004-01-09 16:30:52 +0000688* Thu Jan 08 2004 Paul Jakma <paul@dishone.st>
689- updated sysconfig files to specify local dir
690- added ospf_dump.c crash quick fix patch
691- added ospfd persistent interface configuration patch
692
paul15d74e92003-12-30 11:16:21 +0000693* Tue Dec 30 2003 Paul Jakma <paul@dishone.st>
694- sync to CVS
695- integrate RH sysconfig patch to specify daemon options (RH)
696- default to have vty listen only to 127.1 (RH)
697- add user with fixed UID/GID (RH)
698- create user with shell /sbin/nologin rather than /bin/false (RH)
699- stop daemons on uninstall (RH)
Martin Wintera5efdb62015-10-29 22:15:42 -0700700- delete info file on preun, not postun to avoid deletion on upgrade. (RH)
paul15d74e92003-12-30 11:16:21 +0000701- isisd added
702- cleanup tasks carried out for every daemon
703
paul406f7002003-11-02 07:30:52 +0000704* Sun Nov 2 2003 Paul Jakma <paul@dishone.st>
705- Fix -devel package to include all files
706- Sync to 0.96.4
707
paul6bd8fd32003-08-12 12:54:13 +0000708* Tue Aug 12 2003 Paul Jakma <paul@dishone.st>
709- Renamed to Quagga
710- Sync to Quagga release 0.96
711
Martin Wintera5efdb62015-10-29 22:15:42 -0700712* Thu Mar 20 2003 Paul Jakma <paul@dishone.st>
pauledd7c242003-06-04 13:59:38 +0000713- zebra privileges support
714
Martin Wintera5efdb62015-10-29 22:15:42 -0700715* Tue Mar 18 2003 Paul Jakma <paul@dishone.st>
paule0626852003-03-18 14:11:36 +0000716- Fix mem leak in 'show thread cpu'
717- Ralph Keller's OSPF-API
718- Amir: Fix configure.ac for net-snmp
719
paul448ed4a2003-03-01 15:43:28 +0000720* Sat Mar 1 2003 Paul Jakma <paul@dishone.st>
721- ospfd IOS prefix to interface matching for 'network' statement
722- temporary fix for PtP and IPv6
723- sync to zebra.org CVS
724
paul8f754982003-01-20 04:55:51 +0000725* Mon Jan 20 2003 Paul Jakma <paul@dishone.st>
726- update to latest cvs
727- Yon's "show thread cpu" patch - 17217
728- walk up tree - 17218
729- ospfd NSSA fixes - 16681
730- ospfd nsm fixes - 16824
731- ospfd OLSA fixes and new feature - 16823
732- KAME and ifindex fixes - 16525
733- spec file changes to allow redhat files to be in tree
734
pauld7ccae22003-01-18 00:24:00 +0000735* Sat Dec 28 2002 Alexander Hoogerhuis <alexh@ihatent.com>
736- Added conditionals for building with(out) IPv6, vtysh, RIP, BGP
737- Fixed up some build requirements (patch)
738- Added conditional build requirements for vtysh / snmp
Martin Wintera5efdb62015-10-29 22:15:42 -0700739- Added conditional to files for _bindir depending on vtysh
pauld7ccae22003-01-18 00:24:00 +0000740
paul788cdc62003-01-18 00:22:08 +0000741* Mon Nov 11 2002 Paul Jakma <paulj@alphyra.ie>
742- update to latest CVS
743- add Greg Troxel's md5 buffer copy/dup fix
744- add RIPv1 fix
745- add Frank's multicast flag fix
746
747* Wed Oct 09 2002 Paul Jakma <paulj@alphyra.ie>
748- update to latest CVS
749- timestamped crypt_seqnum patch
750- oi->on_write_q fix
751
752* Mon Sep 30 2002 Paul Jakma <paulj@alphyra.ie>
753- update to latest CVS
754- add vtysh 'write-config (integrated|daemon)' patch
755- always 'make rebuild' in vtysh/ to catch new commands
756
757* Fri Sep 13 2002 Paul Jakma <paulj@alphyra.ie>
758- update to 0.93b
759
760* Wed Sep 11 2002 Paul Jakma <paulj@alphyra.ie>
761- update to latest CVS
762- add "/sbin/ip route flush proto zebra" to zebra RH init on startup
763
764* Sat Aug 24 2002 Paul Jakma <paulj@alphyra.ie>
765- update to current CVS
766- add OSPF point to multipoint patch
767- add OSPF bugfixes
768- add BGP hash optimisation patch
769
770* Fri Jun 14 2002 Paul Jakma <paulj@alphyra.ie>
771- update to 0.93-pre1 / CVS
772- add link state detection support
773- add generic PtP and RFC3021 support
774- various bug fixes
775
776* Thu Aug 09 2001 Elliot Lee <sopwith@redhat.com> 0.91a-6
777- Fix bug #51336
778
Martin Wintera5efdb62015-10-29 22:15:42 -0700779* Wed Aug 1 2001 Trond Eivind Glomsrød <teg@redhat.com> 0.91a-5
paul788cdc62003-01-18 00:22:08 +0000780- Use generic initscript strings instead of initscript specific
781 ( "Starting foo: " -> "Starting $prog:" )
782
783* Fri Jul 27 2001 Elliot Lee <sopwith@redhat.com> 0.91a-4
784- Bump the release when rebuilding into the dist.
785
786* Tue Feb 6 2001 Tim Powers <timp@redhat.com>
787- built for Powertools
788
789* Sun Feb 4 2001 Pekka Savola <pekkas@netcore.fi>
790- Hacked up from PLD Linux 0.90-1, Mandrake 0.90-1mdk and one from zebra.org.
791- Update to 0.91a
792- Very heavy modifications to init.d/*, .spec, pam, i18n, logrotate, etc.
793- Should be quite Red Hat'isque now.