mirror of
https://github.com/sirpdboy/sirpdboy-package.git
synced 2025-01-09 04:17:45 +08:00
cpulimit
This commit is contained in:
parent
bd79885353
commit
4f5a44c467
@ -1,74 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libtorrent-rasterbar
|
||||
PKG_VERSION:=1.2.3
|
||||
PKG_RELEASE=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/arvidn/libtorrent.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=078f7b956ef0d992948852a801e626b1118a1fc5
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
|
||||
PKG_LICENSE:=BSD
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libtorrent-rasterbar
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Rasterbar BitTorrent library
|
||||
URL:=https://www.libtorrent.org/
|
||||
DEPENDS:=+libstdcpp +libopenssl +boost +boost-system +boost-chrono +boost-random $(ICONV_DEPENDS)
|
||||
MAINTAINER:=Arvid Norberg <arvid@libtorrent.org>
|
||||
endef
|
||||
|
||||
define Package/libtorrent-rasterbar/description
|
||||
Rasterbar libtorrent is a C++ library that aims to be a good alternative to
|
||||
all the other bittorrent implementations around. It is a library and not a
|
||||
full featured client, although it comes with a working example client.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
|
||||
|
||||
EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
|
||||
|
||||
TARGET_LDFLAGS += -lstdc++
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-debug \
|
||||
--disable-rpath \
|
||||
--enable-encryption \
|
||||
--enable-deprecated-functions \
|
||||
--with-gnu-ld \
|
||||
--with-openssl=$(STAGING_DIR)/usr \
|
||||
--with-boost=$(STAGING_DIR)/usr \
|
||||
--with-libiconv \
|
||||
--with-libiconv-prefix=$(ICONV_PREFIX)
|
||||
|
||||
define Build/Configure
|
||||
cd $(PKG_BUILD_DIR) ; \
|
||||
sh autotool.sh
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/libtorrent $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent-rasterbar.{a,so*} $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtorrent-rasterbar.pc $(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/libtorrent-rasterbar/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtorrent-rasterbar.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libtorrent-rasterbar))
|
@ -2,8 +2,6 @@
|
||||
module("luci.controller.cpulimit", package.seeall)
|
||||
|
||||
function index()
|
||||
require("luci.i18n")
|
||||
luci.i18n.loadc("cpulimit")
|
||||
if not nixio.fs.access("/etc/config/cpulimit") then
|
||||
return
|
||||
end
|
||||
|
@ -6,16 +6,17 @@ s.addremove=true
|
||||
enable=s:option(Flag,"enabled",translate("Usage restrictions","Usage restrictions"))
|
||||
enable.optional=false
|
||||
enable.rmempty=false
|
||||
local e="ps | awk '{print $5}' | sed '1d' | sort -k2n | uniq | sed '/^\\\[/d' | sed '/sed/d' | sed '/awk/d' | sed '/hostapd/d' | sed '/pppd/d' | sed '/mwan3/d' | sed '/sleep/d' | sed '/sort/d' | sed '/ps/d' | sed '/uniq/d' | awk -F '/' '{print $NF}'"
|
||||
local e=io.popen(e,"r")
|
||||
|
||||
exename = s:option(Value, "exename", translate("exename"), translate("name of the executable program file or path name"))
|
||||
exename.optional = false
|
||||
exename.rmempty = false
|
||||
exename.default = "/usr/bin/transmission-daemon"
|
||||
exename:value("transmission","/usr/bin/transmission-daemon")
|
||||
exename:value("samba","/usr/sbin/smbd")
|
||||
exename:value("mount.ntfs-3g","mount.ntfs-3g")
|
||||
exename:value("vsftpd","/usr/sbin/vsftpd")
|
||||
exename:value("pure-ftpd","/usr/sbin/pure-ftpd")
|
||||
|
||||
exename.default="vsftpd"
|
||||
for e in e:lines()do
|
||||
exename:value(e)
|
||||
end
|
||||
limit = s:option(Value, "limit", translate("limit"))
|
||||
limit.optional = false
|
||||
limit.rmempty = false
|
||||
|
@ -24,7 +24,7 @@ msgid "exename"
|
||||
msgstr "进程名称"
|
||||
|
||||
msgid "name of the executable program file or path name"
|
||||
msgstr "可执行文件名称。不能是应用程序路径!"
|
||||
msgstr "可执行文件名称,或包含路径的应用程序"
|
||||
|
||||
msgid "limit"
|
||||
msgstr "占用率限制"
|
||||
msgstr "占用率限制(自定义时使用不含'%'的整数)"
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
config list
|
||||
option enabled '0'
|
||||
option exename 'ssr-redir'
|
||||
option limit '50'
|
||||
config 'list'
|
||||
option 'exename' '/usr/bin/transmission-daemon'
|
||||
option 'limit' '50'
|
||||
option 'enabled' '0'
|
||||
|
@ -7,10 +7,12 @@ START=99
|
||||
cpulimit_get(){
|
||||
config_get enabled $1 enabled
|
||||
[ $enabled -gt 0 ] || return 1
|
||||
|
||||
config_get limit $1 limit
|
||||
config_get exename $1 exename
|
||||
cpulimit -l $limit -e $exename &
|
||||
}
|
||||
eval exepid=$(pgrep $exename)
|
||||
cpulimit -l $limit -p $exepid &
|
||||
echo cpulimit -l $limit -p $exepid
|
||||
|
||||
start() {
|
||||
config_load cpulimit
|
||||
|
@ -8,8 +8,9 @@ cpulimit_get(){
|
||||
[ $enabled -gt 0 ] || return 1
|
||||
config_get limit $1 limit
|
||||
config_get exename $1 exename
|
||||
cpulimit -l $limit -e $exename &
|
||||
echo cpulimit -l $limit -e $exename
|
||||
eval exepid=$(pgrep $exename)
|
||||
cpulimit -l $limit -p $exepid &
|
||||
echo cpulimit -l $limit -p $exepid
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-cpulimit": {
|
||||
"description": "Grant UCI access for luci-app-cpulimit",
|
||||
"read": {
|
||||
"uci": [ "cpulimit" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "cpulimit" ]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user