[package] add startup script and sample uci configuration file (#5329)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@16524 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
09ad6d2af7
commit
f8732848c9
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=btpd
|
||||
PKG_VERSION:=0.13
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.murmeldjur.se/btpd/
|
||||
@ -35,6 +35,8 @@ define Package/btpd/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/btinfo $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/btpd.init $(1)/etc/init.d/btpd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/btpd.config $(1)/etc/config/btpd
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,btpd))
|
||||
|
7
net/btpd/files/btpd.config
Normal file
7
net/btpd/files/btpd.config
Normal file
@ -0,0 +1,7 @@
|
||||
config 'btpd'
|
||||
option 'directory' '/usb/btpd'
|
||||
option 'maxkbin' '1000'
|
||||
option 'maxkbout' '40'
|
||||
option 'maxpeers' '140'
|
||||
option 'maxuploads' '50'
|
||||
option 'port' '47194'
|
@ -1,16 +1,65 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
START=99
|
||||
|
||||
RUN_D=/var/btpd
|
||||
|
||||
start () {
|
||||
btpd -d $RUN_D
|
||||
append_bool() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local value="$3"
|
||||
local _loctmp
|
||||
config_get_bool _loctmp "$section" "$option"
|
||||
[ "$_loctmp" -gt 0 ] && append args "$value"
|
||||
}
|
||||
|
||||
stop () {
|
||||
echo -n "stop btpd "
|
||||
while btcli -d $RUN_D kill ; do
|
||||
echo -n .
|
||||
sleep 3
|
||||
done 2>/dev/null
|
||||
echo " done"
|
||||
append_parm() {
|
||||
local section="$1"
|
||||
local option="$2"
|
||||
local switch="$3"
|
||||
local _loctmp
|
||||
config_get _loctmp "$section" "$option"
|
||||
[ -z "$_loctmp" ] && return 0
|
||||
append args "$switch $_loctmp"
|
||||
}
|
||||
|
||||
directory=""
|
||||
|
||||
btpd() {
|
||||
local cfg="$1"
|
||||
append_bool "$cfg" emptystart "--empty-start"
|
||||
append_parm "$cfg" port "-p"
|
||||
append_parm "$cfg" directory "-d"
|
||||
append_parm "$cfg" maxpeers "--max-peers"
|
||||
append_parm "$cfg" maxuploads "--max-uploads"
|
||||
append_parm "$cfg" maxkbin "--bw-in"
|
||||
append_parm "$cfg" maxkbout "--bw-out"
|
||||
config_get directory "$cfg" directory
|
||||
}
|
||||
|
||||
start() {
|
||||
include /lib/network
|
||||
config_load btpd
|
||||
args=""
|
||||
config_foreach btpd btpd
|
||||
/usr/bin/btpd $args
|
||||
}
|
||||
|
||||
stop() {
|
||||
include /lib/network
|
||||
config_load btpd
|
||||
args=""
|
||||
config_foreach btpd btpd
|
||||
|
||||
[ -d $direcotry ] && args="-d $directory "
|
||||
echo -n "stop btpd "
|
||||
|
||||
while btcli $args kill ; do
|
||||
echo -n .
|
||||
sleep 3
|
||||
done 2>/dev/null
|
||||
|
||||
killall /usr/bin/btpd > /dev/null 2>&1
|
||||
|
||||
echo " done"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user