##
## bitflu.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2021 OpenPKG Project
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: bitflu
Summary: BitTorrent Daemon Client
URL: http://bitflu.workaround.ch/
Vendor: Adrian Ulrich
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: P2P
License: Artistic
Version: 1.52
Release: 20150712
# list of sources
Source0: http://bitflu.workaround.ch/bitflu/bitflu-%{version}.tgz
Source1: rc.bitflu
Source2: bitflu.config
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101, perl, perl-crypto, perl-sys, perl-util, perl-www
%description
Bitflu is a BitTorrent client running as a Unix daemon.
%track
prog bitflu = {
version = %{version}
url = http://bitflu.workaround.ch/dload.html
regex = bitflu-(__VER__)\.tgz
}
%prep
%setup -q
%build
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/bitflu \
$RPM_BUILD_ROOT%{l_prefix}/var/bitflu/db
# install program
%{l_shtool} install -c -m 755 \
-e "s;'\.bitflu\.config';%{l_prefix}/etc/bitflu/bitflu.config;g" \
-e "s;/usr/bin/perl;%{l_prefix}/bin/perl;g" \
bitflu.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/bitflu
# install configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE bitflu.config} $RPM_BUILD_ROOT%{l_prefix}/etc/bitflu/
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.bitflu} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/bitflu/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/bitflu/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bitflu' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bitflu/db'
%files -f files
%clean
%post
if [ $1 -eq 1 ]; then
# display final hints on initial installation
( echo "To complete this installation of Bitflu, please start Bitflu,"
echo "connect to its Telnet interface, login with the default"
echo "user \"openpkg\" and password \"openpkg\" and change the"
echo "password to custom password \"\":"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc bitflu start"
echo " \$ telnet 127.0.0.1 4001"
echo " # Username: openpkg"
echo " # Password: openpkg"
echo " # user password openpkg openpkg "
echo " # config save"
) | %{l_rpmtool} msg -b -t notice
fi
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} bitflu status 2>/dev/null`
[ ".$bitflu_active" = .yes ] && %{l_rc} bitflu restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} bitflu stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/bitflu/db/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/bitflu/bitflu.* >/dev/null 2>&1 || true
exit 0