zebra.spec 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. ##
  2. ## zebra.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2001 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.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 [REL]
  32. Group: Net
  33. License: GPL
  34. Version: 0.92a
  35. Release: 20011201
  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. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20011227
  47. PreReq: OpenPKG, openpkg >= 20011227
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. GNU Zebra is free software (distributed under GNU Generic Public
  52. License) that manages TCP/IP based routing protocols. It supports
  53. BGP-4 protocol as described in RFC1771 (A Border Gateway Protocol
  54. 4) as well as RIPv1, RIPv2 and OSPFv2. Unlike traditional, Gated
  55. based, monolithic architectures and even the so-called "new modular
  56. architectures" that remove the burden of processing routing
  57. functions from the CPU and utilize special ASIC chips instead, Zebra
  58. software offers true modularity.
  59. %prep
  60. %setup -q
  61. %build
  62. # patch configure script for correct pid directory
  63. %{l_rpmtool} subst \
  64. 's;^ac_piddir=\$ZEBRA_PID_DIR;ac_piddir=%{l_prefix}/var/zebra;' \
  65. -- configure
  66. # configure package
  67. CC="%{l_cc}" \
  68. CFLAGS="%{l_cflags -O}" \
  69. ./configure \
  70. --prefix=%{l_prefix} \
  71. --sysconfdir=%{l_prefix}/etc/zebra \
  72. --disable-ipv6
  73. # build package
  74. %{l_make} %{l_mflags -O}
  75. %install
  76. rm -rf $RPM_BUILD_ROOT
  77. # install package
  78. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  79. # strip down package
  80. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/vtysh.1
  81. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  82. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  83. # replace default configuration
  84. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/*
  85. %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
  86. %{SOURCE bgpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
  87. %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
  88. %{SOURCE ospfd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
  89. %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
  90. %{SOURCE ripd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
  91. %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
  92. %{SOURCE zebra.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
  93. # install run-command script
  94. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  95. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  96. %{SOURCE rc.zebra} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  97. # make sure pid and log directory exists
  98. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/zebra
  99. # determine package file list
  100. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  101. %{l_files_std} \
  102. '%config %{l_prefix}/etc/zebra/*'
  103. %files -f files
  104. %clean
  105. rm -rf $RPM_BUILD_ROOT
  106. %preun
  107. if [ $1 -eq 0 ]; then
  108. $RPM_INSTALL_PREFIX/etc/rc zebra stop
  109. rm -f $RPM_INSTALL_PREFIX/var/zebra/*.log
  110. rm -f $RPM_INSTALL_PREFIX/var/zebra/*.pid
  111. fi