ootoc: sync with upstream source

This commit is contained in:
CN_SZTL 2020-03-13 20:31:26 +08:00
parent 29ffc8bb30
commit 6bfdd264e2
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 18 additions and 11 deletions

View File

@ -15,8 +15,8 @@ PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/ElonH/ootoc.git
PKG_MIRROR_HASH:=b7ec508df4e204bdf12fa679075b1d36c8527ef5f8656415eac1aca31227a44b
PKG_SOURCE_VERSION:=5b919a6c6da5c5c0c007b2820c70a86aa3067aca
PKG_MIRROR_HASH:=8df94810a5c4ab69556531f628006f6f4f7c443a211b386ece4cde65f4e1bd50
PKG_SOURCE_VERSION:=449f254d54e854221f967c4d156f54ee1af224fb
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
@ -40,7 +40,7 @@ define Package/ootoc
CATEGORY:=Base system
URL:=https://github.com/msgpack/ootoc
TITLE:=opkg over tar over curl
DEPENDS:=+libcurl +libyaml-cpp +libtar
DEPENDS:=+libcurl +libyaml-cpp +libtar +spdlog
MENU:=1
endef

View File

@ -11,3 +11,6 @@ config server 'server'
config proxy 'proxy'
option enabled '0'
option proxy_addr 'socks5://127.0.0.1:1080'
config log 'log'
option path '/var/log/ootoc'

View File

@ -16,11 +16,11 @@ _err() {
init_conf() {
config_load "ootoc"
local AUX LOG
config_get AUX server aux_path
config_get LOG log path
# detect aux file exist
[ -d "${AUX%/*}" ] || mkdir -p "${AUX%/*}" 2>/dev/null
[ -f "$AUX" ] || {
@ -38,7 +38,7 @@ init_conf() {
_err "not exist file: $FEEDS"
return 1
}
cp -rf "$FEEDS" "$FEEDS_BAK"
cp -rf "$FEEDS" "$FEEDS_BAK"
}
# create log path
@ -57,7 +57,7 @@ start_service() {
init_conf || return 1;
config_load "ootoc"
local ENABLED ADDR PORT TAR AUX PROXY_ENABLED PROXY_ADDR
local ENABLED ADDR PORT TAR AUX PROXY_ENABLED PROXY_ADDR LOG
config_get ENABLED global enabled
config_get ADDR server addr
config_get PORT server port
@ -65,20 +65,24 @@ start_service() {
config_get AUX server aux_path
config_get PROXY_ENABLED proxy enabled
config_get PROXY_ADDR proxy proxy_addr
config_get LOG log path
[[ $ENABLED == 0 ]] && {
_info "Instance 'ootoc' disabled."
return 1
}
_info "Instance 'ootoc' enabled."
_info "$PROG subscription --addr \"$ADDR\" --port \"$PORT\" -i \"$AUX\" > \"/etc/opkg/distfeeds.conf\""
$PROG subscription --addr "$ADDR" --port "$PORT" -i "$AUX" > "/etc/opkg/distfeeds.conf"
procd_open_instance
procd_set_param command $PROG server
procd_append_param command --addr "$ADDR"
procd_append_param command --port "$PORT"
procd_append_param command --url "$TAR"
procd_append_param command --aux "$AUX"
procd_append_param command --addr "$ADDR"
procd_append_param command --port "$PORT"
procd_append_param command --url "$TAR"
procd_append_param command --aux "$AUX"
procd_append_param command -l "$LOG"
[[ $PROXY_ENABLED == 1 ]] && {
procd_set_param env all_proxy="$PROXY_ADDR" https_proxy="$PROXY_ADDR" http_proxy="$PROXY_ADDR"
procd_set_param env ALL_PROXY="$PROXY_ADDR" HTTPS_PROXY="$PROXY_ADDR" HTTP_PROXY="$PROXY_ADDR"