bitflu.spec 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ##
  2. ## bitflu.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: bitflu
  25. Summary: BitTorrent Daemon Client
  26. URL: http://bitflu.workaround.ch/
  27. Vendor: Adrian Ulrich
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: EVAL
  31. Group: P2P
  32. License: Artistic
  33. Version: 0.52
  34. Release: 20080825
  35. # list of sources
  36. Source0: http://bitflu.workaround.ch/bitflu/bitflu-%{version}.tgz
  37. Source1: rc.bitflu
  38. Source2: bitflu.config
  39. # build information
  40. Prefix: %{l_prefix}
  41. BuildRoot: %{l_buildroot}
  42. BuildPreReq: OpenPKG, openpkg >= 20060823
  43. PreReq: OpenPKG, openpkg >= 20060823, perl, perl-crypto, perl-sys, perl-util, perl-www
  44. AutoReq: no
  45. AutoReqProv: no
  46. %description
  47. Bitflu is a BitTorrent client running as a Unix daemon.
  48. %track
  49. prog bitflu = {
  50. version = %{version}
  51. url = http://bitflu.workaround.ch/dload.html
  52. regex = bitflu-(__VER__)\.tgz
  53. }
  54. %prep
  55. %setup -q
  56. %build
  57. %install
  58. # create installation hierarchy
  59. rm -rf $RPM_BUILD_ROOT
  60. %{l_shtool} mkdir -f -p -m 755 \
  61. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  62. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  63. $RPM_BUILD_ROOT%{l_prefix}/etc/bitflu \
  64. $RPM_BUILD_ROOT%{l_prefix}/var/bitflu/db
  65. # install program
  66. %{l_shtool} install -c -m 755 \
  67. -e "s;'\.bitflu\.config';%{l_prefix}/etc/bitflu/bitflu.config;g" \
  68. -e "s;/usr/bin/perl;%{l_prefix}/bin/perl;g" \
  69. bitflu.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/bitflu
  70. # install configuration
  71. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  72. %{SOURCE bitflu.config} $RPM_BUILD_ROOT%{l_prefix}/etc/bitflu/
  73. # install run-command script
  74. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  75. %{SOURCE rc.bitflu} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  76. # determine installation files
  77. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  78. %{l_files_std} \
  79. '%config %{l_prefix}/etc/bitflu/*' \
  80. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/bitflu/*' \
  81. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bitflu' \
  82. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bitflu/db'
  83. %files -f files
  84. %clean
  85. rm -rf $RPM_BUILD_ROOT
  86. %post
  87. if [ $1 -eq 1 ]; then
  88. # display final hints on initial installation
  89. ( echo "To complete this installation of Bitflu, please start Bitflu,"
  90. echo "connect to its Telnet interface, login with the default"
  91. echo "user \"openpkg\" and password \"openpkg\" and change the"
  92. echo "password to custom password \"<password>\":"
  93. echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc bitflu start"
  94. echo " \$ telnet 127.0.0.1 4001"
  95. echo " # Username: openpkg"
  96. echo " # Password: openpkg"
  97. echo " # user password openpkg openpkg <password>"
  98. echo " # config save"
  99. ) | %{l_rpmtool} msg -b -t notice
  100. fi
  101. # after upgrade, restart service
  102. [ $1 -eq 2 ] || exit 0
  103. eval `%{l_rc} bitflu status 2>/dev/null`
  104. [ ".$bitflu_active" = .yes ] && %{l_rc} bitflu restart
  105. exit 0
  106. %preun
  107. # before erase, stop service and remove log files
  108. [ $1 -eq 0 ] || exit 0
  109. %{l_rc} bitflu stop 2>/dev/null
  110. rm -rf $RPM_INSTALL_PREFIX/var/bitflu/db/* >/dev/null 2>&1 || true
  111. rm -f $RPM_INSTALL_PREFIX/var/bitflu/bitflu.* >/dev/null 2>&1 || true
  112. exit 0