blob: ba1eb190a4a68067fc39275981c2688a87dfd60d [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 Jakma93687462017-02-27 22:42:59 +0000124BuildRequires: perl-generators
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
137%if "%{initsystem}" == "systemd"
138BuildRequires: systemd
139Requires(post): systemd
140Requires(preun): systemd
141Requires(postun): systemd
142%else
paul788cdc62003-01-18 00:22:08 +0000143# Initscripts > 5.60 is required for IPv6 support
Matti-Oskari Leppänenfa755852013-02-15 10:12:55 +0000144Requires(pre): initscripts >= 5.60
Martin Wintera5efdb62015-10-29 22:15:42 -0700145%endif
146Provides: routingdaemon = %{version}-%{release}
147BuildRoot: %{_tmppath}/%{name}-%{version}-root
Paul Jakma93687462017-02-27 22:42:59 +0000148Obsoletes: mrt zebra quagga-sysvinit
149
150%define __perl_requires %{zeb_rh_src}/quagga-filter-perl-requires.sh
paul788cdc62003-01-18 00:22:08 +0000151
152%description
Paul Jakma93687462017-02-27 22:42:59 +0000153Quagga is a free software routing protocol suite.
paul788cdc62003-01-18 00:22:08 +0000154
Paul Jakma93687462017-02-27 22:42:59 +0000155Quagga supports BGP, OSPFv2, OSPFv3, ISIS, RIP, RIPng, PIM-SSM and NHRP.
paul788cdc62003-01-18 00:22:08 +0000156
paul448ed4a2003-03-01 15:43:28 +0000157%package contrib
paul6bd8fd32003-08-12 12:54:13 +0000158Summary: contrib tools for quagga
paul448ed4a2003-03-01 15:43:28 +0000159Group: System Environment/Daemons
160
161%description contrib
paul6bd8fd32003-08-12 12:54:13 +0000162Contributed/3rd party tools which may be of use with quagga.
paul448ed4a2003-03-01 15:43:28 +0000163
paule0626852003-03-18 14:11:36 +0000164%package devel
paul6bd8fd32003-08-12 12:54:13 +0000165Summary: Header and object files for quagga development
paule0626852003-03-18 14:11:36 +0000166Group: System Environment/Daemons
Martin Wintera5efdb62015-10-29 22:15:42 -0700167Requires: %{name} = %{version}-%{release}
paule0626852003-03-18 14:11:36 +0000168
169%description devel
paul6bd8fd32003-08-12 12:54:13 +0000170The quagga-devel package contains the header and object files neccessary for
171developing OSPF-API and quagga applications.
paule0626852003-03-18 14:11:36 +0000172
paul788cdc62003-01-18 00:22:08 +0000173%prep
Martin Wintera5efdb62015-10-29 22:15:42 -0700174%setup -q -n quagga-%{quaggaversion}
paul788cdc62003-01-18 00:22:08 +0000175
176%build
ajs7966b972004-11-10 22:02:05 +0000177
178# For standard gcc verbosity, uncomment these lines:
179#CFLAGS="%{optflags} -Wall -Wsign-compare -Wpointer-arith"
180#CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings"
181
182# For ultra gcc verbosity, uncomment these lines also:
183#CFLAGS="${CFLAGS} -W -Wcast-qual -Wstrict-prototypes"
184#CFLAGS="${CFLAGS} -Wmissing-declarations -Wmissing-noreturn"
185#CFLAGS="${CFLAGS} -Wmissing-format-attribute -Wunreachable-code"
186#CFLAGS="${CFLAGS} -Wpacked -Wpadded"
187
paul788cdc62003-01-18 00:22:08 +0000188%configure \
Martin Wintera5efdb62015-10-29 22:15:42 -0700189 --sysconfdir=%{_sysconfdir} \
Paul Jakma93687462017-02-27 22:42:59 +0000190 --libdir=%{_libdir}/quagga \
Martin Wintera5efdb62015-10-29 22:15:42 -0700191 --libexecdir=%{_libexecdir} \
192 --localstatedir=%{_localstatedir} \
193 --disable-werror \
paul54b25dc2004-09-30 04:56:26 +0000194%if !%{with_shared}
195 --disable-shared \
196%endif
paul54b25dc2004-09-30 04:56:26 +0000197%if %{with_snmp}
paul788cdc62003-01-18 00:22:08 +0000198 --enable-snmp \
199%endif
paul54b25dc2004-09-30 04:56:26 +0000200%if %{with_multipath}
201 --enable-multipath=%{with_multipath} \
paul788cdc62003-01-18 00:22:08 +0000202%endif
paul54b25dc2004-09-30 04:56:26 +0000203%if %{with_tcp_zebra}
paul788cdc62003-01-18 00:22:08 +0000204 --enable-tcp-zebra \
205%endif
paul54b25dc2004-09-30 04:56:26 +0000206%if %{with_vtysh}
paul788cdc62003-01-18 00:22:08 +0000207 --enable-vtysh \
208%endif
paul54b25dc2004-09-30 04:56:26 +0000209%if %{with_ospfclient}
paul68980082003-03-25 05:07:42 +0000210 --enable-ospfclient=yes \
211%else
212 --enable-ospfclient=no\
213%endif
paul54b25dc2004-09-30 04:56:26 +0000214%if %{with_ospfapi}
paul68980082003-03-25 05:07:42 +0000215 --enable-ospfapi=yes \
216%else
217 --enable-ospfapi=no \
218%endif
paul54b25dc2004-09-30 04:56:26 +0000219%if %{with_irdp}
paul5b819262004-07-28 14:11:55 +0000220 --enable-irdp=yes \
221%else
222 --enable-irdp=no \
223%endif
paule7cd37b2005-09-08 15:18:39 +0000224%if %{with_rtadv}
225 --enable-rtadv=yes \
226%else
227 --enable-rtadv=no \
228%endif
paul54b25dc2004-09-30 04:56:26 +0000229%if %{with_isisd}
230 --enable-isisd \
231%else
paul69f5d262004-10-07 16:23:36 +0000232 --disable-isisd \
paul54b25dc2004-09-30 04:56:26 +0000233%endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200234%if %{with_nhrpd}
235 --enable-nhrpd \
236%else
237 --disable-nhrpd \
238%endif
paul54b25dc2004-09-30 04:56:26 +0000239%if %{with_pam}
pauledd7c242003-06-04 13:59:38 +0000240 --with-libpam \
paul788cdc62003-01-18 00:22:08 +0000241%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700242%if 0%{?quagga_user:1}
paul6bd8fd32003-08-12 12:54:13 +0000243 --enable-user=%quagga_user \
244 --enable-group=%quagga_user \
pauledd7c242003-06-04 13:59:38 +0000245%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700246%if 0%{?vty_group:1}
pauledd7c242003-06-04 13:59:38 +0000247 --enable-vty-group=%vty_group \
248%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700249%if %{with_fpm}
250 --enable-fpm \
251%else
252 --disable-fpm \
253%endif
254%if %{with_watchquagga}
255 --enable-watchquagga \
256%else
257 --disable-watchquagga \
258%endif
259 --enable-gcc-rdynamic
paul788cdc62003-01-18 00:22:08 +0000260
261make %{?_smp_mflags} MAKEINFO="makeinfo --no-split"
262
263pushd doc
Martin Wintera5efdb62015-10-29 22:15:42 -0700264%if %{texi2htmlversion} < 5
265texi2html --number-sections quagga.texi
266%else
Paul Jakmae07068c2015-09-04 14:25:13 +0100267texi2html --number-footnotes --number-sections quagga.texi
Martin Wintera5efdb62015-10-29 22:15:42 -0700268%endif
paul788cdc62003-01-18 00:22:08 +0000269popd
270
271%install
Martin Wintera5efdb62015-10-29 22:15:42 -0700272mkdir -p %{buildroot}/etc/{quagga,sysconfig,logrotate.d,pam.d} \
273 %{buildroot}/var/log/quagga %{buildroot}%{_infodir}
274make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" install
paul788cdc62003-01-18 00:22:08 +0000275
paul9a344b72003-08-05 23:24:58 +0000276# Remove this file, as it is uninstalled and causes errors when building on RH9
Martin Wintera5efdb62015-10-29 22:15:42 -0700277rm -rf %{buildroot}/usr/share/info/dir
paul9a344b72003-08-05 23:24:58 +0000278
Martin Wintera5efdb62015-10-29 22:15:42 -0700279# install /etc sources
280%if "%{initsystem}" == "systemd"
281mkdir -p %{buildroot}%{_unitdir}
282for daemon in %{all_daemons} ; do
283 if [ x"${daemon}" != x"" ] ; then
284 install %{zeb_rh_src}/${daemon}.service \
285 %{buildroot}%{_unitdir}/${daemon}.service
286 fi
287done
288%else
289mkdir -p %{buildroot}/etc/rc.d/init.d
ajsb3324e22004-12-22 17:52:29 +0000290for daemon in %{all_daemons} ; do
paulda29c6b2004-10-08 00:49:09 +0000291 if [ x"${daemon}" != x"" ] ; then
292 install %{zeb_rh_src}/${daemon}.init \
Martin Wintera5efdb62015-10-29 22:15:42 -0700293 %{buildroot}/etc/rc.d/init.d/${daemon}
paulda29c6b2004-10-08 00:49:09 +0000294 fi
paul15d74e92003-12-30 11:16:21 +0000295done
Martin Wintera5efdb62015-10-29 22:15:42 -0700296%endif
297
Paul Jakma283d5d72016-02-11 13:54:23 +0000298install -m644 %{zeb_rh_src}/quagga.pam \
Martin Wintera5efdb62015-10-29 22:15:42 -0700299 %{buildroot}/etc/pam.d/quagga
paul15d74e92003-12-30 11:16:21 +0000300install -m644 %{zeb_rh_src}/quagga.logrotate \
Martin Wintera5efdb62015-10-29 22:15:42 -0700301 %{buildroot}/etc/logrotate.d/quagga
paul15d74e92003-12-30 11:16:21 +0000302install -m644 %{zeb_rh_src}/quagga.sysconfig \
Martin Wintera5efdb62015-10-29 22:15:42 -0700303 %{buildroot}/etc/sysconfig/quagga
304install -d -m750 %{buildroot}/var/run/quagga
pauledd7c242003-06-04 13:59:38 +0000305
Paul Jakma93687462017-02-27 22:42:59 +0000306
307%if 0%{?_tmpfilesdir:1}
308 install -d -m 755 %{buildroot}/%{_tmpfilesdir}
309 install -p -m 644 %{zeb_rh_src}/quagga-tmpfs.conf \
310 %{buildroot}/%{_tmpfilesdir}/quagga.conf
311%endif
312
pauledd7c242003-06-04 13:59:38 +0000313%pre
314# add vty_group
Martin Wintera5efdb62015-10-29 22:15:42 -0700315%if 0%{?vty_group:1}
paule7cd37b2005-09-08 15:18:39 +0000316if getent group %vty_group > /dev/null ; then : ; else \
Martin Wintera5efdb62015-10-29 22:15:42 -0700317 /usr/sbin/groupadd -r -g %vty_gid %vty_group > /dev/null || : ; fi
pauledd7c242003-06-04 13:59:38 +0000318%endif
paule7cd37b2005-09-08 15:18:39 +0000319
paul6bd8fd32003-08-12 12:54:13 +0000320# add quagga user and group
Martin Wintera5efdb62015-10-29 22:15:42 -0700321%if 0%{?quagga_user:1}
paule7cd37b2005-09-08 15:18:39 +0000322# Ensure that quagga_gid gets correctly allocated
323if getent group %quagga_user >/dev/null; then : ; else \
324 /usr/sbin/groupadd -g %quagga_gid %quagga_user > /dev/null || : ; \
325fi
326if getent passwd %quagga_user >/dev/null ; then : ; else \
Timo Schöler2e0fb0e2017-02-23 13:16:42 +0000327 /usr/sbin/useradd -u %quagga_uid -g %quagga_gid -G %vty_group \
paule7cd37b2005-09-08 15:18:39 +0000328 -M -r -s /sbin/nologin -c "Quagga routing suite" \
329 -d %_localstatedir %quagga_user 2> /dev/null || : ; \
330fi
pauledd7c242003-06-04 13:59:38 +0000331%endif
paul788cdc62003-01-18 00:22:08 +0000332
paul788cdc62003-01-18 00:22:08 +0000333%post
paul30b9d892003-01-18 22:57:15 +0000334# zebra_spec_add_service <service name> <port/proto> <comment>
paul788cdc62003-01-18 00:22:08 +0000335# e.g. zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
336
337zebra_spec_add_service ()
338{
339 # Add port /etc/services entry if it isn't already there
paul6b637e92004-10-23 00:48:51 +0000340 if [ -f /etc/services ] && \
341 ! %__sed -e 's/#.*$//' /etc/services | %__grep -wq $1 ; then
paul788cdc62003-01-18 00:22:08 +0000342 echo "$1 $2 # $3" >> /etc/services
343 fi
344}
345
346zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
347zebra_spec_add_service zebra 2601/tcp "zebra vty"
348zebra_spec_add_service ripd 2602/tcp "RIPd vty"
349zebra_spec_add_service ripngd 2603/tcp "RIPngd vty"
350zebra_spec_add_service ospfd 2604/tcp "OSPFd vty"
351zebra_spec_add_service bgpd 2605/tcp "BGPd vty"
352zebra_spec_add_service ospf6d 2606/tcp "OSPF6d vty"
paul54b25dc2004-09-30 04:56:26 +0000353%if %{with_ospfapi}
paul7021c422003-07-15 12:52:22 +0000354zebra_spec_add_service ospfapi 2607/tcp "OSPF-API"
355%endif
paul54b25dc2004-09-30 04:56:26 +0000356%if %{with_isisd}
jardin5a514b12003-12-23 10:50:21 +0000357zebra_spec_add_service isisd 2608/tcp "ISISd vty"
paul54b25dc2004-09-30 04:56:26 +0000358%endif
Everton Marques871dbcf2009-08-11 15:43:05 -0300359%if %{with_pimd}
360zebra_spec_add_service pimd 2611/tcp "PIMd vty"
361%endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200362%if %{with_nhrpd}
363zebra_spec_add_service nhrpd 2612/tcp "NHRPd vty"
364%endif
paul788cdc62003-01-18 00:22:08 +0000365
Martin Wintera5efdb62015-10-29 22:15:42 -0700366%if "%{initsystem}" == "systemd"
367for daemon in %all_daemons ; do
368 %systemd_post ${daemon}.service
369done
370%else
371for daemon in %all_daemons ; do
paul15d74e92003-12-30 11:16:21 +0000372 /sbin/chkconfig --add ${daemon}
373done
Martin Wintera5efdb62015-10-29 22:15:42 -0700374%endif
paul788cdc62003-01-18 00:22:08 +0000375
Paul Jakma93687462017-02-27 22:42:59 +0000376if [ -f %{_infodir}/%{name}.inf* ]; then
377 /sbin/install-info %{_infodir}/quagga.info %{_infodir}/dir
378fi
paul788cdc62003-01-18 00:22:08 +0000379
380# Create dummy files if they don't exist so basic functions can be used.
381if [ ! -e %{_sysconfdir}/zebra.conf ]; then
382 echo "hostname `hostname`" > %{_sysconfdir}/zebra.conf
Martin Wintera5efdb62015-10-29 22:15:42 -0700383%if 0%{?quagga_user:1}
384 chown %quagga_user:%quagga_user %{_sysconfdir}/zebra.conf*
paule7cd37b2005-09-08 15:18:39 +0000385%endif
paul788cdc62003-01-18 00:22:08 +0000386 chmod 640 %{_sysconfdir}/zebra.conf
387fi
Martin Wintera5efdb62015-10-29 22:15:42 -0700388for daemon in %{all_daemons} ; do
389 if [ ! -e %{_sysconfdir}/${daemon}.conf ]; then
390 touch %{_sysconfdir}/${daemon}.conf
391 %if 0%{?quagga_user:1}
392 chown %quagga_user:%quagga_user %{_sysconfdir}/${daemon}.conf*
393 %endif
394 fi
395done
396%if %{with_watchquagga}
397 # No config for watchquagga - this is part of /etc/sysconfig/quagga
398 rm -f %{_sysconfdir}/watchquagga.*
399%endif
400
paul788cdc62003-01-18 00:22:08 +0000401if [ ! -e %{_sysconfdir}/vtysh.conf ]; then
402 touch %{_sysconfdir}/vtysh.conf
403 chmod 640 %{_sysconfdir}/vtysh.conf
Martin Wintera5efdb62015-10-29 22:15:42 -0700404%if 0%{?vty_group:1}
405 chown quagga:%{vty_group} %{_sysconfdir}/vtysh.conf*
406%endif
paul788cdc62003-01-18 00:22:08 +0000407fi
408
409%postun
ajsfc43ecc2005-01-12 16:41:33 +0000410if [ "$1" -ge 1 ]; then
411 # Find out which daemons need to be restarted.
ajsb3324e22004-12-22 17:52:29 +0000412 for daemon in %all_daemons ; do
Martin Wintera5efdb62015-10-29 22:15:42 -0700413 if [ -f /var/lock/subsys/${daemon} ]; then
414 eval restart_${daemon}=yes
ajsfc43ecc2005-01-12 16:41:33 +0000415 else
Martin Wintera5efdb62015-10-29 22:15:42 -0700416 eval restart_${daemon}=no
ajsfc43ecc2005-01-12 16:41:33 +0000417 fi
paul15d74e92003-12-30 11:16:21 +0000418 done
ajsfc43ecc2005-01-12 16:41:33 +0000419 # Rename restart flags for daemons handled specially.
420 running_zebra="$restart_zebra"
421 restart_zebra=no
Martin Wintera5efdb62015-10-29 22:15:42 -0700422 %if %{with_watchquagga}
423 running_watchquagga="$restart_watchquagga"
424 restart_watchquagga=no
425 %endif
426
427 %if "%{initsystem}" == "systemd"
428 ##
429 ## Systemd Version
430 ##
431 # No watchquagga for systemd version
432 #
433 # Stop all daemons other than zebra.
434 for daemon in %all_daemons ; do
435 eval restart=\$restart_${daemon}
436 [ "$restart" = yes ] && \
Paul Jakma93687462017-02-27 22:42:59 +0000437 %systemd_postun_with_restart ${daemon}.service
Martin Wintera5efdb62015-10-29 22:15:42 -0700438 done
439 # Restart zebra.
440 [ "$running_zebra" = yes ] && \
441 %systemd_postun_with_restart $daemon.service
442 # Start all daemons other than zebra.
443 for daemon in %all_daemons ; do
444 eval restart=\$restart_${daemon}
445 [ "$restart" = yes ] && \
446 %systemd_post ${daemon}.service
447 done
448 %else
449 ##
450 ## init.d Version
451 ##
452 %if %{with_watchquagga}
453 # Stop watchquagga first.
454 [ "$running_watchquagga" = yes ] && \
455 /etc/rc.d/init.d/watchquagga stop >/dev/null 2>&1
456 %endif
457 # Stop all daemons other than zebra and watchquagga.
458 for daemon in %all_daemons ; do
459 eval restart=\$restart_${daemon}
460 [ "$restart" = yes ] && \
461 /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
462 done
463 # Restart zebra.
464 [ "$running_zebra" = yes ] && \
465 /etc/rc.d/init.d/zebra restart >/dev/null 2>&1
466 # Start all daemons other than zebra and watchquagga.
467 for daemon in %all_daemons ; do
468 eval restart=\$restart_${daemon}
469 [ "$restart" = yes ] && \
470 /etc/rc.d/init.d/${daemon} start >/dev/null 2>&1
471 done
472 %if %{with_watchquagga}
473 # Start watchquagga last.
474 # Avoid postun scriptlet error if watchquagga is not running.
475 [ "$running_watchquagga" = yes ] && \
476 /etc/rc.d/init.d/watchquagga start >/dev/null 2>&1 || :
477 %endif
478 %endif
paul788cdc62003-01-18 00:22:08 +0000479fi
paul788cdc62003-01-18 00:22:08 +0000480
Paul Jakma93687462017-02-27 22:42:59 +0000481if [ -f %{_infodir}/%{name}.inf* ]; then
482 /sbin/install-info --delete %{_infodir}/quagga.info %{_infodir}/dir
483fi
484
paul788cdc62003-01-18 00:22:08 +0000485%preun
Martin Wintera5efdb62015-10-29 22:15:42 -0700486%if "%{initsystem}" == "systemd"
487 ##
488 ## Systemd Version
489 ##
490 if [ "$1" = "0" ]; then
491 for daemon in %all_daemons ; do
492 %systemd_preun ${daemon}.service
493 done
494 fi
495%else
496 ##
497 ## init.d Version
498 ##
499 if [ "$1" = "0" ]; then
500 for daemon in %all_daemons ; do
501 /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1
502 /sbin/chkconfig --del ${daemon}
503 done
504 fi
505%endif
paul788cdc62003-01-18 00:22:08 +0000506
507%clean
Martin Wintera5efdb62015-10-29 22:15:42 -0700508%if !0%{?keep_build:1}
509rm -rf %{buildroot}
paulb5f310c2004-09-13 13:15:25 +0000510%endif
paul788cdc62003-01-18 00:22:08 +0000511
512%files
513%defattr(-,root,root)
paul448ed4a2003-03-01 15:43:28 +0000514%doc */*.sample* AUTHORS COPYING
paul6bd8fd32003-08-12 12:54:13 +0000515%doc doc/quagga.html
paul30b9d892003-01-18 22:57:15 +0000516%doc doc/mpls
paul8f754982003-01-20 04:55:51 +0000517%doc ChangeLog INSTALL NEWS README REPORTING-BUGS SERVICES TODO
Martin Wintera5efdb62015-10-29 22:15:42 -0700518%if 0%{?quagga_user:1}
paul6bd8fd32003-08-12 12:54:13 +0000519%dir %attr(751,%quagga_user,%quagga_user) %{_sysconfdir}
520%dir %attr(750,%quagga_user,%quagga_user) /var/log/quagga
521%dir %attr(751,%quagga_user,%quagga_user) /var/run/quagga
pauledd7c242003-06-04 13:59:38 +0000522%else
paul788cdc62003-01-18 00:22:08 +0000523%dir %attr(750,root,root) %{_sysconfdir}
paul6bd8fd32003-08-12 12:54:13 +0000524%dir %attr(750,root,root) /var/log/quagga
paul6bd8fd32003-08-12 12:54:13 +0000525%dir %attr(750,root,root) /var/run/quagga
pauledd7c242003-06-04 13:59:38 +0000526%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700527%if 0%{?vty_group:1}
paul6bd8fd32003-08-12 12:54:13 +0000528%attr(750,%quagga_user,%vty_group) %{_sysconfdir}/vtysh.conf.sample
pauledd7c242003-06-04 13:59:38 +0000529%endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700530%{_infodir}/quagga.info.gz
paul788cdc62003-01-18 00:22:08 +0000531%{_mandir}/man*/*
Paul Jakma93687462017-02-27 22:42:59 +0000532%if %{with_watchquagga}
533 %{_mandir}/man*/watchquagga.*
534%endif
paul54b25dc2004-09-30 04:56:26 +0000535%{_sbindir}/zebra
536%{_sbindir}/ospfd
537%{_sbindir}/ripd
538%{_sbindir}/bgpd
Martin Wintera5efdb62015-10-29 22:15:42 -0700539%if %{with_watchquagga}
540 %{_sbindir}/watchquagga
541%endif
paul54b25dc2004-09-30 04:56:26 +0000542%{_sbindir}/ripngd
543%{_sbindir}/ospf6d
Paul Jakma283d5d72016-02-11 13:54:23 +0000544%if %{with_pimd}
545%{_sbindir}/pimd
paul54b25dc2004-09-30 04:56:26 +0000546%endif
547%if %{with_isisd}
548%{_sbindir}/isisd
549%endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200550%if %{with_nhrpd}
551%{_sbindir}/nhrpd
552%endif
paul28f79722004-10-29 05:35:43 +0000553%if %{with_shared}
Paul Jakma93687462017-02-27 22:42:59 +0000554%{_libdir}/quagga/lib*.so
555%{_libdir}/quagga/lib*.so.?
556%attr(755,root,root) %{_libdir}/quagga/lib*.so.?.?.?
paul54b25dc2004-09-30 04:56:26 +0000557%endif
558%if %{with_vtysh}
paul788cdc62003-01-18 00:22:08 +0000559%{_bindir}/*
pauld7ccae22003-01-18 00:24:00 +0000560%endif
paul6bd8fd32003-08-12 12:54:13 +0000561%config /etc/quagga/[!v]*
Martin Wintera5efdb62015-10-29 22:15:42 -0700562%if "%{initsystem}" == "systemd"
Paul Jakma93687462017-02-27 22:42:59 +0000563 %{_unitdir}/*.service
Martin Wintera5efdb62015-10-29 22:15:42 -0700564%else
565 %config /etc/rc.d/init.d/zebra
566 %if %{with_watchquagga}
567 %config /etc/rc.d/init.d/watchquagga
568 %endif
569 %config /etc/rc.d/init.d/ripd
570 %config /etc/rc.d/init.d/ospfd
571 %config /etc/rc.d/init.d/bgpd
572 %config /etc/rc.d/init.d/ripngd
573 %config /etc/rc.d/init.d/ospf6d
574 %if %{with_isisd}
575 %config /etc/rc.d/init.d/isisd
576 %endif
577 %if %{with_pimd}
578 %config /etc/rc.d/init.d/pimd
579 %endif
Timo Teräs2d78fe72017-02-14 13:07:39 +0200580 %if %{with_nhrpd}
581 %config /etc/rc.d/init.d/nhrpd
582 %endif
Martin Wintera5efdb62015-10-29 22:15:42 -0700583%endif
paul15d74e92003-12-30 11:16:21 +0000584%config(noreplace) /etc/sysconfig/quagga
paul6bd8fd32003-08-12 12:54:13 +0000585%config(noreplace) /etc/pam.d/quagga
paul788cdc62003-01-18 00:22:08 +0000586%config(noreplace) %attr(640,root,root) /etc/logrotate.d/*
Paul Jakma93687462017-02-27 22:42:59 +0000587%{_tmpfilesdir}/quagga.conf
paul788cdc62003-01-18 00:22:08 +0000588
paul448ed4a2003-03-01 15:43:28 +0000589%files contrib
590%defattr(-,root,root)
Paul Jakma93687462017-02-27 22:42:59 +0000591%doc AUTHORS COPYING %attr(0644,root,root) tools
paul448ed4a2003-03-01 15:43:28 +0000592
paule0626852003-03-18 14:11:36 +0000593%files devel
594%defattr(-,root,root)
Paul Jakma93687462017-02-27 22:42:59 +0000595%doc AUTHORS COPYING
paulda29c6b2004-10-08 00:49:09 +0000596%if %{with_ospfclient}
597%{_sbindir}/ospfclient
598%endif
Paul Jakma93687462017-02-27 22:42:59 +0000599%dir %{_libdir}/quagga/
600%{_libdir}/quagga/*.a
601%{_libdir}/quagga/*.la
paulcfc18422004-10-23 00:05:41 +0000602%dir %attr(755,root,root) %{_includedir}/%{name}
paul28f79722004-10-29 05:35:43 +0000603%{_includedir}/%name/*.h
paulcfc18422004-10-23 00:05:41 +0000604%dir %attr(755,root,root) %{_includedir}/%{name}/ospfd
paul28f79722004-10-29 05:35:43 +0000605%{_includedir}/%name/ospfd/*.h
paul54b25dc2004-09-30 04:56:26 +0000606%if %{with_ospfapi}
paulcfc18422004-10-23 00:05:41 +0000607%dir %attr(755,root,root) %{_includedir}/%{name}/ospfapi
paul28f79722004-10-29 05:35:43 +0000608%{_includedir}/%name/ospfapi/*.h
paul68980082003-03-25 05:07:42 +0000609%endif
paule0626852003-03-18 14:11:36 +0000610
paul788cdc62003-01-18 00:22:08 +0000611%changelog
Paul Jakma93687462017-02-27 22:42:59 +0000612* Mon Feb 27 2017 Paul Jakma <paul@jakma.org> - %{version}
613- Apply 0001-systemd-various-service-file-improvements.patch from Fedora
614- Review Fedora spec file and sync up with any useful differences, inc:
615- Add tmpfiles.d config for Quagga from Fedora
616- Add quagga-filter-perl-requires.sh from Fedora.
617- Move libs to %{_libdir}/quagga as per Fedora
618- use systemd_postun_with_restart for postun
619
Timo Teräs2d78fe72017-02-14 13:07:39 +0200620* Tue Feb 14 2017 Timo Teräs <timo.teras@iki.fi> - %{version}
621- add nhrpd
622
623* Thu Feb 11 2016 Paul Jakma <paul@jakma.org>
Paul Jakma283d5d72016-02-11 13:54:23 +0000624- remove with_ipv6 conditionals, always build v6
625- Fix UTF-8 char in spec changelog
626- remove quagga.pam.stack, long deprecated.
627
Martin Wintera5efdb62015-10-29 22:15:42 -0700628* Thu Oct 22 2015 Martin Winter <mwinter@opensourcerouting.org>
629- Cleanup configure: remove --enable-ipv6 (default now), --enable-nssa,
630 --enable-netlink
631- Remove support for old fedora 4/5
632- Fix for package nameing
633- Fix Weekdays of previous changelogs (bogus dates)
634- Add conditional logic to only build tex footnotes with supported texi2html
635- Added pimd to files section and fix double listing of /var/lib*/quagga
636- Numerous fixes to unify upstart/systemd startup into same spec file
637- Only allow use of watchquagga for non-systemd systems. no need with systemd
638
639* Fri Sep 4 2015 Paul Jakma <paul@jakma.org>
Paul Jakmae07068c2015-09-04 14:25:13 +0100640- buildreq updates
641- add a default define for with_pimd
642
Martin Wintera5efdb62015-10-29 22:15:42 -0700643* Mon Sep 12 2005 Paul Jakma <paul@dishone.st>
paule7cd37b2005-09-08 15:18:39 +0000644- Steal some changes from Fedora spec file:
645- Add with_rtadv variable
646- Test for groups/users with getent before group/user adding
647- Readline need not be an explicit prerequisite
648- install-info delete should be postun, not preun
649
ajsfc43ecc2005-01-12 16:41:33 +0000650* Wed Jan 12 2005 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
651- on package upgrade, implement careful, phased restart logic
652- use gcc -rdynamic flag when linking for better backtraces
653
ajsb3324e22004-12-22 17:52:29 +0000654* Wed Dec 22 2004 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
ajsf3931752004-12-23 00:00:58 +0000655- daemonv6_list should contain only IPv6 daemons
656
657* Wed Dec 22 2004 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
ajsb3324e22004-12-22 17:52:29 +0000658- watchquagga added
659- on upgrade, all daemons should be condrestart'ed
660- on removal, all daemons should be stopped
661
paul36002ae2004-11-08 17:36:29 +0000662* Mon Nov 08 2004 Paul Jakma <paul@dishone.st>
663- Use makeinfo --html to generate quagga.html
664
paul0df63b52004-11-07 22:12:23 +0000665* Sun Nov 07 2004 Paul Jakma <paul@dishone.st>
666- Fix with_ipv6 set to 0 build
667
paulcfc18422004-10-23 00:05:41 +0000668* Sat Oct 23 2004 Paul Jakma <paul@dishone.st>
669- Update to 0.97.2
670
671* Sat Oct 23 2004 Andrew J. Schorr <aschorr@telemetry-investments.com>
672- Make directories be owned by the packages concerned
673- Update logrotate scripts to use correct path to killall and use pid files
674
paulda29c6b2004-10-08 00:49:09 +0000675* Fri Oct 08 2004 Paul Jakma <paul@dishone.st>
676- Update to 0.97.0
677
paul54b25dc2004-09-30 04:56:26 +0000678* Wed Sep 15 2004 Paul Jakma <paul@dishone.st>
679- build snmp support by default
680- build irdp support
681- build with shared libs
682- devel subpackage for archives and headers
683
paul00bc5602004-01-09 16:30:52 +0000684* Thu Jan 08 2004 Paul Jakma <paul@dishone.st>
685- updated sysconfig files to specify local dir
686- added ospf_dump.c crash quick fix patch
687- added ospfd persistent interface configuration patch
688
paul15d74e92003-12-30 11:16:21 +0000689* Tue Dec 30 2003 Paul Jakma <paul@dishone.st>
690- sync to CVS
691- integrate RH sysconfig patch to specify daemon options (RH)
692- default to have vty listen only to 127.1 (RH)
693- add user with fixed UID/GID (RH)
694- create user with shell /sbin/nologin rather than /bin/false (RH)
695- stop daemons on uninstall (RH)
Martin Wintera5efdb62015-10-29 22:15:42 -0700696- delete info file on preun, not postun to avoid deletion on upgrade. (RH)
paul15d74e92003-12-30 11:16:21 +0000697- isisd added
698- cleanup tasks carried out for every daemon
699
paul406f7002003-11-02 07:30:52 +0000700* Sun Nov 2 2003 Paul Jakma <paul@dishone.st>
701- Fix -devel package to include all files
702- Sync to 0.96.4
703
paul6bd8fd32003-08-12 12:54:13 +0000704* Tue Aug 12 2003 Paul Jakma <paul@dishone.st>
705- Renamed to Quagga
706- Sync to Quagga release 0.96
707
Martin Wintera5efdb62015-10-29 22:15:42 -0700708* Thu Mar 20 2003 Paul Jakma <paul@dishone.st>
pauledd7c242003-06-04 13:59:38 +0000709- zebra privileges support
710
Martin Wintera5efdb62015-10-29 22:15:42 -0700711* Tue Mar 18 2003 Paul Jakma <paul@dishone.st>
paule0626852003-03-18 14:11:36 +0000712- Fix mem leak in 'show thread cpu'
713- Ralph Keller's OSPF-API
714- Amir: Fix configure.ac for net-snmp
715
paul448ed4a2003-03-01 15:43:28 +0000716* Sat Mar 1 2003 Paul Jakma <paul@dishone.st>
717- ospfd IOS prefix to interface matching for 'network' statement
718- temporary fix for PtP and IPv6
719- sync to zebra.org CVS
720
paul8f754982003-01-20 04:55:51 +0000721* Mon Jan 20 2003 Paul Jakma <paul@dishone.st>
722- update to latest cvs
723- Yon's "show thread cpu" patch - 17217
724- walk up tree - 17218
725- ospfd NSSA fixes - 16681
726- ospfd nsm fixes - 16824
727- ospfd OLSA fixes and new feature - 16823
728- KAME and ifindex fixes - 16525
729- spec file changes to allow redhat files to be in tree
730
pauld7ccae22003-01-18 00:24:00 +0000731* Sat Dec 28 2002 Alexander Hoogerhuis <alexh@ihatent.com>
732- Added conditionals for building with(out) IPv6, vtysh, RIP, BGP
733- Fixed up some build requirements (patch)
734- Added conditional build requirements for vtysh / snmp
Martin Wintera5efdb62015-10-29 22:15:42 -0700735- Added conditional to files for _bindir depending on vtysh
pauld7ccae22003-01-18 00:24:00 +0000736
paul788cdc62003-01-18 00:22:08 +0000737* Mon Nov 11 2002 Paul Jakma <paulj@alphyra.ie>
738- update to latest CVS
739- add Greg Troxel's md5 buffer copy/dup fix
740- add RIPv1 fix
741- add Frank's multicast flag fix
742
743* Wed Oct 09 2002 Paul Jakma <paulj@alphyra.ie>
744- update to latest CVS
745- timestamped crypt_seqnum patch
746- oi->on_write_q fix
747
748* Mon Sep 30 2002 Paul Jakma <paulj@alphyra.ie>
749- update to latest CVS
750- add vtysh 'write-config (integrated|daemon)' patch
751- always 'make rebuild' in vtysh/ to catch new commands
752
753* Fri Sep 13 2002 Paul Jakma <paulj@alphyra.ie>
754- update to 0.93b
755
756* Wed Sep 11 2002 Paul Jakma <paulj@alphyra.ie>
757- update to latest CVS
758- add "/sbin/ip route flush proto zebra" to zebra RH init on startup
759
760* Sat Aug 24 2002 Paul Jakma <paulj@alphyra.ie>
761- update to current CVS
762- add OSPF point to multipoint patch
763- add OSPF bugfixes
764- add BGP hash optimisation patch
765
766* Fri Jun 14 2002 Paul Jakma <paulj@alphyra.ie>
767- update to 0.93-pre1 / CVS
768- add link state detection support
769- add generic PtP and RFC3021 support
770- various bug fixes
771
772* Thu Aug 09 2001 Elliot Lee <sopwith@redhat.com> 0.91a-6
773- Fix bug #51336
774
Martin Wintera5efdb62015-10-29 22:15:42 -0700775* Wed Aug 1 2001 Trond Eivind Glomsrød <teg@redhat.com> 0.91a-5
paul788cdc62003-01-18 00:22:08 +0000776- Use generic initscript strings instead of initscript specific
777 ( "Starting foo: " -> "Starting $prog:" )
778
779* Fri Jul 27 2001 Elliot Lee <sopwith@redhat.com> 0.91a-4
780- Bump the release when rebuilding into the dist.
781
782* Tue Feb 6 2001 Tim Powers <timp@redhat.com>
783- built for Powertools
784
785* Sun Feb 4 2001 Pekka Savola <pekkas@netcore.fi>
786- Hacked up from PLD Linux 0.90-1, Mandrake 0.90-1mdk and one from zebra.org.
787- Update to 0.91a
788- Very heavy modifications to init.d/*, .spec, pam, i18n, logrotate, etc.
789- Should be quite Red Hat'isque now.