vrrpd.spec 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ##
  2. ## vrrpd.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. # FIXME: rse: unfortunately currently available for FreeBSD 4 only
  26. # package information
  27. Name: vrrpd
  28. Summary: Virtual Router Redundancy Protocol (VRRP) Daemon
  29. URL: http://www.bsdshell.net/hut_vrrpimpl.html
  30. Vendor: The HUT Project
  31. Packager: The OpenPKG Project
  32. Distribution: OpenPKG [JUNK]
  33. Group: Network
  34. License: BSD
  35. Version: 0.8.7
  36. Release: 20031001
  37. # package options
  38. %option with_fsl yes
  39. # list of sources
  40. Source0: http://www.bsdshell.net/download/freevrrpd-%{version}.tar.gz
  41. Source1: vrrpd.conf
  42. Source2: rc.vrrpd
  43. Source3: fsl.vrrpd
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20030909
  48. PreReq: OpenPKG, openpkg >= 20030909
  49. %if "%{with_fsl}" == "yes"
  50. BuildPreReq: fsl >= 1.2.0
  51. PreReq: fsl >= 1.2.0
  52. %endif
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. Vrrpd is a Virtual Router Redundancy Protocol (VRRP) implementation.
  57. This permits you to create backups of your strategic servers with a
  58. redundant IP system.
  59. %prep
  60. %setup -q -n freevrrpd-%{version}
  61. %build
  62. %{l_shtool} subst \
  63. -e 's;"freevrrpd";"vrrpd";' \
  64. vrrp_main.c
  65. %{l_shtool} subst \
  66. -e 's;/usr/local/etc/freevrrpd.conf;%{l_prefix}/etc/vrrpd/vrrpd.conf;' \
  67. vrrp_define.h
  68. %{l_shtool} subst \
  69. -e "s;^\\(LDADD=.*\\);\\1 %{l_fsl_ldflags} %{l_fsl_libs};" \
  70. Makefile
  71. case "%{l_platform -t}" in
  72. *-freebsd* ) ;;
  73. * ) echo "Sorry, this package currently supports FreeBSD 4 only" |\
  74. %{l_rpmtool} msg -t error; exit 1 ;;
  75. esac
  76. /usr/bin/make CC=/usr/bin/cc
  77. %install
  78. rm -rf $RPM_BUILD_ROOT
  79. %{l_shtool} mkdir -f -p -m 755 \
  80. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  81. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  82. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  83. $RPM_BUILD_ROOT%{l_prefix}/etc/vrrpd \
  84. $RPM_BUILD_ROOT%{l_prefix}/var/vrrpd
  85. %{l_shtool} install -c -s -m 755 \
  86. freevrrpd $RPM_BUILD_ROOT%{l_prefix}/sbin/vrrpd
  87. %{l_shtool} install -c -m 644 \
  88. freevrrpd.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/vrrpd.8
  89. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  90. %{SOURCE vrrpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/vrrpd/
  91. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  92. %{SOURCE rc.vrrpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  93. # install OSSP fsl configuration
  94. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  95. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  96. %{SOURCE fsl.vrrpd} \
  97. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  98. # determine installation files
  99. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  100. %{l_files_std} \
  101. '%not %dir %{l_prefix}/etc/fsl' \
  102. '%config %{l_prefix}/etc/fsl/fsl.vrrpd' \
  103. '%config %{l_prefix}/etc/vrrpd/vrrpd.conf'
  104. %files -f files
  105. %clean
  106. rm -rf $RPM_BUILD_ROOT
  107. %post
  108. # after upgrade, restart service
  109. [ $1 -eq 2 ] || exit 0
  110. eval `%{l_rc} vrrpd status 2>/dev/null`
  111. [ ".$vrrpd_active" = .yes ] && %{l_rc} vrrpd restart
  112. exit 0
  113. %preun
  114. # before erase, stop service and remove log files
  115. [ $1 -eq 0 ] || exit 0
  116. %{l_rc} vrrpd stop 2>/dev/null
  117. rm -f $RPM_INSTALL_PREFIX/var/vrrpd/vrrpd.log* >/dev/null 2>&1 || true
  118. exit 0