zebra.spec 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ##
  2. ## zebra.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: zebra
  27. Summary: Internet Routing Daemon
  28. URL: http://www.zebra.org/
  29. Vendor: Kunihiro Ishiguro
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [BASE]
  32. Group: Network
  33. License: GPL
  34. Version: 0.93b
  35. Release: 20031001
  36. # list of sources
  37. Source0: ftp://ftp.zebra.org/pub/zebra/zebra-%{version}.tar.gz
  38. Source1: rc.zebra
  39. Source2: bgpd.conf
  40. Source3: ospfd.conf
  41. Source4: ripd.conf
  42. Source5: zebra.conf
  43. Source6: vtysh.conf
  44. Patch0: zebra.patch
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20030718, gcc, perl
  49. PreReq: OpenPKG, openpkg >= 20030718
  50. BuildPreReq: readline
  51. PreReq: readline
  52. AutoReq: no
  53. AutoReqProv: no
  54. Conflicts: quagga
  55. %description
  56. GNU Zebra is free software (distributed under GNU Generic Public
  57. License) that manages TCP/IP based routing protocols. It supports
  58. BGP-4 protocol as described in RFC1771 (A Border Gateway Protocol
  59. 4) as well as RIPv1, RIPv2 and OSPFv2. Unlike traditional, Gated
  60. based, monolithic architectures and even the so-called "new modular
  61. architectures" that remove the burden of processing routing
  62. functions from the CPU and utilize special ASIC chips instead, Zebra
  63. software offers true modularity.
  64. %prep
  65. %setup -q
  66. %patch -p0
  67. %build
  68. # patch configure script for correct pid directory
  69. %{l_shtool} subst \
  70. -e 's;^ac_piddir=\$ZEBRA_PID_DIR;ac_piddir=%{l_prefix}/var/zebra;' \
  71. configure
  72. # configure package
  73. CC="%{l_cc}" \
  74. CFLAGS="%{l_cflags -O}" \
  75. CPPFLAGS="%{l_cppflags}" \
  76. LDFLAGS="%{l_ldflags}" \
  77. ./configure \
  78. --prefix=%{l_prefix} \
  79. --sysconfdir=%{l_prefix}/etc/zebra \
  80. --enable-vtysh \
  81. --disable-ospf6d \
  82. --disable-ripngd \
  83. --disable-ipv6 \
  84. --without-libpam
  85. # rebuild vtysh command list
  86. ( cd vtysh
  87. %{l_shtool} subst -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' extract.pl
  88. %{l_make} %{l_mflags} rebuild
  89. ) || exit $?
  90. # build package
  91. %{l_make} %{l_mflags -O}
  92. %install
  93. rm -rf $RPM_BUILD_ROOT
  94. # install package
  95. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  96. # strip down package
  97. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ospf6d.8
  98. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ripngd.8
  99. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  100. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  101. # replace default configuration
  102. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/*
  103. %{l_shtool} install -c -m 600 %{l_value -s -a} \
  104. %{SOURCE zebra.conf} %{SOURCE vtysh.conf} \
  105. %{SOURCE ripd.conf} %{SOURCE ospfd.conf} %{SOURCE bgpd.conf} \
  106. $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
  107. %{l_shtool} install -c -m 600 /dev/null \
  108. $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/zebra.conf.integrate
  109. # install run-command script
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  112. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  113. %{SOURCE rc.zebra} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  114. # make sure pid and log directory exists
  115. %{l_shtool} mkdir -f -p -m 755 \
  116. $RPM_BUILD_ROOT%{l_prefix}/var/zebra
  117. # determine package file list
  118. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  119. %{l_files_std} \
  120. '%config %{l_prefix}/etc/zebra/*'
  121. %files -f files
  122. %clean
  123. rm -rf $RPM_BUILD_ROOT
  124. %post
  125. # after upgrade, restart service
  126. [ $1 -eq 2 ] || exit 0
  127. eval `%{l_rc} zebra status 2>/dev/null`
  128. [ ".$zebra_active" = .yes ] && %{l_rc} zebra restart
  129. exit 0
  130. %preun
  131. # before erase, stop service and remove log files
  132. [ $1 -eq 0 ] || exit 0
  133. %{l_rc} zebra stop 2>/dev/null
  134. rm -f $RPM_INSTALL_PREFIX/var/zebra/zebra.log* >/dev/null 2>&1 || true
  135. exit 0