1%define version @VERSION@
2
3Summary:	Zebra routing engine
4Name:		zebra
5Version:	%{version}
6Release:	1
7Source:		zebra-%{version}.tar.gz
8URL:		http://www.zebra.org
9Copyright:	GPL
10Group:		System Environment/Daemons
11BuildRoot:	/tmp/zebra-%{version}-root
12
13%description
14GNU Zebra is free software (distributed under GNU Generic Public License)
15that manages TCP/IP based routing protocols. It supports BGP-4 protocol as
16described in RFC1771 (A Border Gateway Protocol 4) as well as RIPv1, RIPv2
17and OSPFv2. Unlike traditional, Gated based, monolithic architectures and
18even the so-called "new modular architectures" that remove the burden of
19processing routing functions from the cpu and utilize special ASIC chips
20instead, Zebra software offers true modularity.
21
22%prep
23%setup
24
25%build
26#./configure --enable-snmp --prefix=/usr --sysconfdir=/etc
27./configure --prefix=/usr --sysconfdir=/etc
28make
29
30%install
31rm -rf $RPM_BUILD_ROOT
32make DESTDIR=$RPM_BUILD_ROOT install
33rm -f $RPM_BUILD_ROOT/usr/info/dir
34rm -f $RPM_BUILD_ROOT/usr/man/man8/ospf6*
35rm -f $RPM_BUILD_ROOT/usr/man/man8/ripng*
36rm -f $RPM_BUILD_ROOT/usr/sbin/ospf6d
37rm -f $RPM_BUILD_ROOT/usr/sbin/ripngd
38strip $RPM_BUILD_ROOT/usr/sbin/*
39
40mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
41install -m755 init/redhat/bgpd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/bgpd
42#install -m755 init/redhat/ospf6d.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ospf6d
43install -m755 init/redhat/ospfd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ospfd
44install -m755 init/redhat/ripd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ripd
45#install -m755 init/redhat/ripngd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ripngd
46install -m755 init/redhat/zebra.init $RPM_BUILD_ROOT/etc/rc.d/init.d/zebra 
47
48mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
49install -m644 init/redhat/zebra.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/zebra
50
51
52%post
53# zebra_spec_add_service <sercice name> <port/proto> <comment>
54# e.g. zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
55
56zebra_spec_add_service ()
57{
58  # Add port /etc/services entry if it isn't already there 
59  if [ -f /etc/services ] && ! grep -q "^$1[^a-zA-Z0-9]" /etc/services ; then
60    echo "$1            $2              # $3"  >> /etc/services
61  fi
62}
63
64zebra_spec_add_service zebrasrv 2600/tcp "zebra service"
65zebra_spec_add_service zebra    2601/tcp "zebra vty"
66zebra_spec_add_service ripd     2602/tcp "RIPd vty"
67zebra_spec_add_service ripngd   2603/tcp "RIPngd vty"
68zebra_spec_add_service ospfd    2604/tcp "OSPFd vty"
69zebra_spec_add_service bgpd     2605/tcp "BGPd vty"
70zebra_spec_add_service ospf6d   2606/tcp "OSPF6d vty"
71
72#Install info
73/sbin/install-info /usr/info/zebra.info /usr/info/dir
74
75if [ -x /sbin/chkconfig ]; then
76  chkconfig --add bgpd
77#  chkconfig --add ospf6d
78  chkconfig --add ospfd
79  chkconfig --add ripd
80#  chkconfig --add ripngd
81  chkconfig --add zebra
82fi
83
84
85%preun
86if [ "$1" = 0 ] ; then
87  /sbin/install-info --delete /usr/info/zebra.info /usr/info/dir
88
89  if [ -x /sbin/chkconfig ]; then
90    chkconfig --del bgpd
91#    chkconfig --del ospf6d
92    chkconfig --del ospfd
93    chkconfig --del ripd
94#    chkconfig --del ripngd
95    chkconfig --del zebra
96  fi
97fi
98
99%clean
100rm -rf $RPM_BUILD_ROOT
101rm -rf $RPM_BUILD_DIR/%{name}-%{version}
102
103%files
104%attr(-,root,root) %doc AUTHORS COPYING ChangeLog INSTALL NEWS README SERVICES TODO bgpd/bgpd.conf.sample ospfd/ospfd.conf.sample ripd/ripd.conf.sample zebra/zebra.conf.sample
105%attr(-,root,root) %config /etc/rc.d/init.d/*
106%attr(-,root,root) %config /etc/logrotate.d/*
107%attr(-,root,root) /usr/info/*
108#%attr(-,root,root) /usr/man/*      # Not man1 to exclude vtysh man page as
109                                    # it is not build by default (for now)
110%attr(-,root,root) /usr/man/man8/*
111%attr(-,root,root) /usr/sbin/*
112
113%changelog
114* Mon Nov 6 2000 Lennert Buytenhek <buytenh@gnu.org>
115- Don't include ospf6d and ripngd in package.
116- Fix logrotate file (add ospf.log).
117* Mon Oct 2 2000 Horms <horms@valinux.com>
118- Install and uninstall info in %post and %preun respectively
119- Moved chkconfig --del operations from %postun to %preun, as
120  chkconfig needs to run while the init files are still present on
121  the system.
122- Don't install vtysh man page as vtysh is not build by default
123- Added logrotate script so logs won't grow without bound
124* Wed Sep 27 2000 Horms <horms@vergenet.net>
125- Add ports to /etc/services if they aren't there
126- forcibly remove $RPM_BUILD_ROOT/usr/info/dir and friends so
127  there is no error if it does not exist when rm is run.
128- Clean up the zebra build dir 
129