Rclone-OpenWrt: add packages
This commit is contained in:
parent
590161937a
commit
36269b00fd
@ -64,7 +64,8 @@ luci-app-dockerman source: [lisaac/luci-app-dockerman](https://github.com/lisaac
|
||||
luci-lib-docker source: [lisaac/luci-lib-docker](https://github.com/lisaac/luci-lib-docker).<br/>
|
||||
openwrt-iptvhelper source: [riverscn/openwrt-iptvhelper](https://github.com/riverscn/openwrt-iptvhelper).<br>
|
||||
luci-app-autoipsetadder source: [rufengsuixing/luci-app-autoipsetadder](https://github.com/rufengsuixing/luci-app-autoipsetadder).<br>
|
||||
luci-app-adguardhome source: [rufengsuixing/luci-app-adguardhome](https://github.com/rufengsuixing/luci-app-adguardhome).
|
||||
luci-app-adguardhome source: [rufengsuixing/luci-app-adguardhome](https://github.com/rufengsuixing/luci-app-adguardhome).<br/>
|
||||
Rclone-OpenWrt source:[ElonH/Rclone-OpenWrt](https://github.com/ElonH/Rclone-OpenWrt).
|
||||
|
||||
# License
|
||||
### [GPL v3](https://www.gnu.org/licenses/gpl-3.0.html).
|
||||
|
||||
23
package/ctcgfw/luci-app-rclone/Makefile
Normal file
23
package/ctcgfw/luci-app-rclone/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
####
|
||||
# File: /Makefile
|
||||
# Project: luci-app-rclone
|
||||
# File Created: Wednesday, 9th October 2019 1:39:36 pm
|
||||
# Author: ElonH[EH](elonhhuang@gmail.com)
|
||||
# License: GNU General Public License v3.0 or later(http://www.gnu.org/licenses/gpl-3.0-standalone.html)
|
||||
# Copyright (C) 2019 [ElonH]
|
||||
####
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for Rclone
|
||||
LUCI_DEPENDS:=+rclone +rclone-webui-react
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-rclone
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPLv3.0+
|
||||
PKG_MAINTAINER:=ElonH <elonhhuang@gmail.com>
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@ -0,0 +1,8 @@
|
||||
module("luci.controller.rclone", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/rclone") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services", "rclone"}, cbi("rclone"), _("Rclone"), 100 ).dependent = false
|
||||
end
|
||||
93
package/ctcgfw/luci-app-rclone/luasrc/model/cbi/rclone.lua
Normal file
93
package/ctcgfw/luci-app-rclone/luasrc/model/cbi/rclone.lua
Normal file
@ -0,0 +1,93 @@
|
||||
require('luci.sys')
|
||||
require('luci.util')
|
||||
require('luci.model.ipkg')
|
||||
local fs = require 'nixio.fs'
|
||||
|
||||
local uci = require 'luci.model.uci'.cursor()
|
||||
|
||||
local m, s
|
||||
|
||||
local running = (luci.sys.call('pidof rclone > /dev/null') == 0)
|
||||
|
||||
local state_msg = ''
|
||||
local trport = uci:get('rclone', 'config', 'port')
|
||||
|
||||
if running then
|
||||
state_msg = '<b><font color="green">' .. translate('rclone运行中') .. '</font></b>'
|
||||
else
|
||||
state_msg = '<b><font color="red">' .. translate('rclone未运行') .. '</font></b>'
|
||||
end
|
||||
|
||||
m =
|
||||
Map(
|
||||
'rclone',
|
||||
translate('Rclone'),
|
||||
translate('Rclone是一款的命令行工具,支持在不同对象存储、网盘间同步、上传、下载数据。') ..
|
||||
' <br/> <br/> ' ..
|
||||
translate('rclone运行状态') ..
|
||||
' : ' ..
|
||||
state_msg ..
|
||||
'<br/> <br/>' ..
|
||||
translate('已安装的WEB界面') ..
|
||||
' <input type="button" class="cbi-button" style="margin: 0 5px;" value=" ' ..
|
||||
translate('Webui React') ..
|
||||
" \" onclick=\"window.open('http://'+window.location.hostname+'/rclone-webui-react')\"/> <br/><br/>"
|
||||
)
|
||||
|
||||
s = m:section(TypedSection, 'global', translate('全局'))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag, 'enabled', translate('启用 Rclone 后台服务'))
|
||||
enable.rmempty = false
|
||||
|
||||
-- user = s:option(ListValue, 'user', translate('以此用户权限运行'))
|
||||
-- local p_user
|
||||
-- for _, p_user in luci.util.vspairs(luci.util.split(luci.sys.exec('cat /etc/passwd | cut -f 1 -d :'))) do
|
||||
-- user:value(p_user)
|
||||
-- end
|
||||
-- TODO: user add rclone
|
||||
|
||||
s = m:section(TypedSection, 'conf', translate('配置'))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(ListValue, 'addr_type', translate('监听地址'))
|
||||
o:value('local', translate('监听本机地址'))
|
||||
o:value('lan', translate('监听局域网地址'))
|
||||
o:value('wan', translate('监听全部地址'))
|
||||
o.default = 'lan'
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'port', translate('监听端口'))
|
||||
o.placeholder = 5572
|
||||
o.default = 5572
|
||||
o.datatype = 'port'
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'config_path', translate('配置文件路径'))
|
||||
o.placeholder = '/etc/rclone/rclone.conf'
|
||||
o.default = '/etc/rclone/rclone.conf'
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'username', translate('用户名'))
|
||||
o.placeholder = 'admin'
|
||||
o.default = 'admin'
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'password', translate('密码'))
|
||||
o.password = true
|
||||
o.placeholder = 'admin'
|
||||
o.default = 'admin'
|
||||
o.rmempty = false
|
||||
|
||||
s = m:section(TypedSection, 'log', translate('日志'))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Value, 'path', translate('路径'))
|
||||
o.placeholder = '/var/log/rclone/output'
|
||||
o.default = '/var/log/rclone/output'
|
||||
o.rmempty = false
|
||||
|
||||
return m
|
||||
14
package/ctcgfw/luci-app-rclone/root/etc/config/rclone
Normal file
14
package/ctcgfw/luci-app-rclone/root/etc/config/rclone
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
config global 'global'
|
||||
option enabled '0'
|
||||
option user 'rclone'
|
||||
|
||||
config conf 'config'
|
||||
option config_path '/etc/rclone/rclone.conf'
|
||||
option port '5572'
|
||||
option username 'admin'
|
||||
option password 'admin'
|
||||
option addr_type 'lan'
|
||||
|
||||
config log 'log'
|
||||
option path '/var/log/rclone/output'
|
||||
90
package/ctcgfw/luci-app-rclone/root/etc/init.d/rclone
Executable file
90
package/ctcgfw/luci-app-rclone/root/etc/init.d/rclone
Executable file
@ -0,0 +1,90 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2019 ElonH <elonhhuang@gmail.com>
|
||||
|
||||
USE_PROCD=1
|
||||
START=95
|
||||
STOP=10
|
||||
|
||||
APP=rclone
|
||||
CONFIGURATION=rclone
|
||||
|
||||
_info() {
|
||||
logger -p daemon.info -t "$APP" "$*"
|
||||
}
|
||||
|
||||
_err() {
|
||||
logger -p daemon.err -t "$APP" "$*"
|
||||
}
|
||||
|
||||
init_config() {
|
||||
config_load "${CONFIGURATION}"
|
||||
# Create rclone dirs
|
||||
local config_path
|
||||
local config_dir
|
||||
local log_path
|
||||
local log_dir
|
||||
|
||||
config_get config_path config config_path
|
||||
config_get log_path log path
|
||||
|
||||
config_dir=${config_path%/*}
|
||||
[ -d $config_dir ] || mkdir -p $config_dir
|
||||
|
||||
log_dir=${log_path%/*}
|
||||
[ -d $log_dir ] || mkdir -p $log_dir && echo /dev/null > $log_path
|
||||
|
||||
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_config
|
||||
|
||||
local enabled
|
||||
local config_path
|
||||
local addr_type
|
||||
local port
|
||||
local username
|
||||
local password
|
||||
|
||||
local user
|
||||
|
||||
local log_path
|
||||
|
||||
config_get enabled global enabled
|
||||
config_get user global user
|
||||
|
||||
config_get config_path config config_path
|
||||
config_get addr_type config addr_type
|
||||
config_get port config port
|
||||
config_get username config username
|
||||
config_get password config password
|
||||
|
||||
|
||||
config_get log_path log path
|
||||
|
||||
if [ "${addr_type}" == "local" ]; then
|
||||
addr="$(uci get network.loopback.ipaddr)"
|
||||
elif [ "${addr_type}" == "lan" ]; then
|
||||
addr="$(uci get network.lan.ipaddr)"
|
||||
elif [ "${addr_type}" == "wan" ]; then
|
||||
addr=""
|
||||
fi
|
||||
[ "$enabled" == "1" ] || { _info "Instance \"rclone\" disabled."; return 1; }
|
||||
_info "Instance \"rclone\" start."
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/bin/$APP rcd -vv
|
||||
procd_append_param command --rc-addr=:${port}
|
||||
procd_append_param command --rc-user=${username} --rc-pass=${password}
|
||||
procd_append_param command --config=${config_path}
|
||||
procd_append_param command --rc-allow-origin=*
|
||||
procd_append_param command --log-file=${log_path}
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param file /etc/config/rclone
|
||||
# procd_set_param pidfile /var/run/rclone.pid
|
||||
procd_set_param user $user
|
||||
procd_set_param group rclone
|
||||
procd_set_param respawn retry=60
|
||||
procd_close_instance
|
||||
|
||||
}
|
||||
11
package/ctcgfw/luci-app-rclone/root/etc/uci-defaults/100_luci-rclone
Executable file
11
package/ctcgfw/luci-app-rclone/root/etc/uci-defaults/100_luci-rclone
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@rclone[-1]
|
||||
add ucitrack rclone
|
||||
set ucitrack.@rclone[-1].init=rclone
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
58
package/ctcgfw/rclone-webui-react/Makefile
Normal file
58
package/ctcgfw/rclone-webui-react/Makefile
Normal file
@ -0,0 +1,58 @@
|
||||
####
|
||||
# File: /Makefile
|
||||
# Project: rclone-webui-react
|
||||
# File Created: Thursday, 10th October 2019 5:57:39 pm
|
||||
# Author: ElonH[EH](elonhhuang@gmail.com)
|
||||
# License: GNU General Public License v3.0 or later(http://www.gnu.org/licenses/gpl-3.0-standalone.html)
|
||||
# Copyright (C) 2019 [ElonH]
|
||||
####
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rclone-webui-react
|
||||
PKG_VERSION:=0.0.8
|
||||
PKG_RELEASE:=1
|
||||
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_MAINTAINER:=ElonH <elonhhuang@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
PKG_SOURCE:=currentbuild.zip
|
||||
PKG_SOURCE_URL:=https://github.com/rclone/rclone-webui-react/releases/download/v$(PKG_VERSION)/
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_HASH:=8f09d67ddbd8923a8f57ea05dc6b82a711a65eed926a6bc61c1a88a13d960839
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=File Transfer
|
||||
SUBMENU:=Cloud Manager
|
||||
TITLE:=A reactjs based web UI for rclone
|
||||
URL:=https://github.com/rclone/rclone-webui-react
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
A full fledged UI for the rclone cloud sync tool.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -vp $(PKG_BUILD_DIR)
|
||||
unzip -od $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
echo "$(PKG_NAME) Compile Skiped!"
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/www/rclone-webui-react
|
||||
$(CP) $(PKG_BUILD_DIR)/build/* $(1)/www/rclone-webui-react
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
74
package/ctcgfw/rclone/Makefile
Normal file
74
package/ctcgfw/rclone/Makefile
Normal file
@ -0,0 +1,74 @@
|
||||
####
|
||||
# File: /Makefile
|
||||
# Project: rclone
|
||||
# File Created: Friday, 11th October 2019 4:50:49 pm
|
||||
# Author: ElonH[EH](elonhhuang@gmail.com)
|
||||
# License: GNU General Public License v3.0 or later(http://www.gnu.org/licenses/gpl-3.0-standalone.html)
|
||||
# Copyright (C) 2019 [ElonH]
|
||||
####
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rclone
|
||||
PKG_VERSION:=1.49.5
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rclone/rclone.git
|
||||
PKG_SOURCE_VERSION:=5d3323605080509cf53de5980443c6d02fd50a48
|
||||
PKG_SOURCE_DATE:=20191011
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_MAINTAINER:=ElonH <elonhhuang@gmail.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0 # https://github.com/openwrt/packages/issues/8498
|
||||
GO_PKG:=github.com/rclone/rclone
|
||||
GO_PKG_EXCLUDES:=test
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
# GO_PKG_LDFLAGS:=
|
||||
GO_PKG_LDFLAGS_X:=\
|
||||
github.com/rclone/rclone/fs.Version=v$(PKG_VERSION)_$(PKG_SOURCE_DATE)\
|
||||
main.Version=v$(PKG_VERSION) \
|
||||
main.BuildUser=openwrt \
|
||||
main.BuildHost=openwrt \
|
||||
main.BuildStamp=$(SOURCE_DATE_EPOCH)
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=rsync for cloud storage.
|
||||
URL:=https://rclone.org
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Rclone ("rsync for cloud storage") is a command line program to sync root/usr/bin and directories to and from different cloud storage providers.
|
||||
Cloud storage providers:
|
||||
1Fichier, Alibaba Cloud (Aliyun) Object Storage System (OSS), Amazon Drive, Amazon S3,
|
||||
Backblaze B2, Box, Ceph, C14, DigitalOcean Spaces, Dreamhost, Dropbox, FTP,
|
||||
Google Cloud Storage, Google Drive, Google Photos, HTTP, Hubic, Jottacloud,
|
||||
IBM COS S3, Koofr, Memset Memstore, Mega, Microsoft Azure Blob Storage,
|
||||
Microsoft OneDrive, Minio, Nextcloud, OVH, OpenDrive, Openstack Swift,
|
||||
Oracle Cloud Storage, ownCloud, pCloud, premiumize.me, put.io, QingStor,
|
||||
Rackspace Cloud root/usr/bin, rsync.net, Scaleway, SFTP, Wasabi, WebDAV,
|
||||
Yandex Disk, The local root/usr/binystem.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
# echo "++++++++++++++++++"
|
||||
# echo "$(PKG_INSTALL_DIR)"
|
||||
# echo "$(1)"
|
||||
# echo "$(GO_PKG_BUILD_BIN_DIR)"
|
||||
# echo "++++++++++++++++++"
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/rclone $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
22
package/ctcgfw/rclone/patches/000-disable-plugins.patch
Normal file
22
package/ctcgfw/rclone/patches/000-disable-plugins.patch
Normal file
@ -0,0 +1,22 @@
|
||||
##
|
||||
# File: /patches/000-disable-plugins.patch
|
||||
# Project: rclone
|
||||
# Created Date: Wednesday, January 1st 2020, 1:49:43 pm
|
||||
# Author: ElonH[EH](elonhhuang@gmail.com)
|
||||
# License: GNU General Public License v3.0 or later(http://www.gnu.org/licenses/gpl-3.0-standalone.html)
|
||||
# Copyright (C) 2019 [ElonH]
|
||||
##
|
||||
# refs: https://github.com/openwrt/packages/issues/10864#issuecomment-569921457
|
||||
diff --git a/rclone.go b/rclone.go
|
||||
index 74fde16ab..9a9ba9150 100644
|
||||
--- a/rclone.go
|
||||
+++ b/rclone.go
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
_ "github.com/rclone/rclone/backend/all" // import all backends
|
||||
"github.com/rclone/rclone/cmd"
|
||||
_ "github.com/rclone/rclone/cmd/all" // import all commands
|
||||
- _ "github.com/rclone/rclone/lib/plugin" // import plugins
|
||||
+ // _ "github.com/rclone/rclone/lib/plugin" // import plugins
|
||||
)
|
||||
|
||||
func main() {
|
||||
Loading…
Reference in New Issue
Block a user