bitflu.spec 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. ##
  2. ## bitflu.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: bitflu
  26. Summary: BitTorrent Daemon Client
  27. URL: http://bitflu.workaround.ch/
  28. Vendor: Adrian Ulrich
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: P2P
  33. License: Artistic
  34. Version: 0.32
  35. Release: 20070225
  36. # list of sources
  37. Source0: http://bitflu.workaround.ch/bitflu/bitflu-%{version}.tgz
  38. Source1: rc.bitflu
  39. Source2: bitflu.config
  40. Patch0: bitflu.patch
  41. # build information
  42. Prefix: %{l_prefix}
  43. BuildRoot: %{l_buildroot}
  44. BuildPreReq: OpenPKG, openpkg >= 20060823
  45. PreReq: OpenPKG, openpkg >= 20060823, perl, perl-crypto, perl-sys, perl-util, perl-www
  46. AutoReq: no
  47. AutoReqProv: no
  48. %description
  49. Bitflu is a BitTorrent client running as a Unix daemon.
  50. %track
  51. prog bitflu = {
  52. version = %{version}
  53. url = http://bitflu.workaround.ch/dload.html
  54. regex = bitflu-(__VER__)\.tgz
  55. }
  56. %prep
  57. %setup -q -n bitflu
  58. %patch -p0
  59. %build
  60. %install
  61. # create installation hierarchy
  62. rm -rf $RPM_BUILD_ROOT
  63. %{l_shtool} mkdir -f -p -m 755 \
  64. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  65. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  66. $RPM_BUILD_ROOT%{l_prefix}/etc/bitflu \
  67. $RPM_BUILD_ROOT%{l_prefix}/var/bitflu/db
  68. # install program
  69. %{l_shtool} install -c -m 755 \
  70. -e "s;'\.bitflu\.config';%{l_prefix}/etc/bitflu/bitflu.config;g" \
  71. -e "s;/usr/bin/perl;%{l_prefix}/bin/perl;g" \
  72. bitflu.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/bitflu
  73. # install configuration
  74. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  75. %{SOURCE bitflu.config} $RPM_BUILD_ROOT%{l_prefix}/etc/bitflu/
  76. # install run-command script
  77. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  78. %{SOURCE rc.bitflu} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  79. # determine installation files
  80. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  81. %{l_files_std} \
  82. '%config %{l_prefix}/etc/bitflu/*' \
  83. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/bitflu/*' \
  84. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bitflu' \
  85. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bitflu/db'
  86. %files -f files
  87. %clean
  88. rm -rf $RPM_BUILD_ROOT
  89. %post
  90. if [ $1 -eq 1 ]; then
  91. # display final hints on initial installation
  92. ( echo "To complete this installation of Bitflu, please start Bitflu,"
  93. echo "connect to its Telnet interface, login with the default"
  94. echo "user \"openpkg\" and password \"openpkg\" and change the"
  95. echo "password to custom password \"<password>\":"
  96. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc bitflu start"
  97. echo " \$ telnet 127.0.0.1 4001"
  98. echo " # Username: openpkg"
  99. echo " # Password: openpkg"
  100. echo " # user password openpkg openpkg <password>"
  101. echo " # config save"
  102. ) | %{l_rpmtool} msg -b -t notice
  103. fi
  104. # after upgrade, restart service
  105. [ $1 -eq 2 ] || exit 0
  106. eval `%{l_rc} bitflu status 2>/dev/null`
  107. [ ".$bitflu_active" = .yes ] && %{l_rc} bitflu restart
  108. exit 0
  109. %preun
  110. # before erase, stop service and remove log files
  111. [ $1 -eq 0 ] || exit 0
  112. %{l_rc} bitflu stop 2>/dev/null
  113. rm -rf $RPM_INSTALL_PREFIX/var/bitflu/db/* >/dev/null 2>&1 || true
  114. rm -f $RPM_INSTALL_PREFIX/var/bitflu/bitflu.* >/dev/null 2>&1 || true
  115. exit 0