quagga.spec 5.4 KB

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