mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 01:15:13 +08:00
update 2026-09-24 16:56:26
This commit is contained in:
1 parent
b31a5c3878
commit
e4cee331e9
6885 files changed
+3240523
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2017-2020 Yousong Zhou <yszhou4tech@gmail.com>
|
||||
# Copyright (C) 2021-2023 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=aliyundrive-webdav
|
||||
PKG_VERSION:=2.3.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/messense/aliyundrive-webdav.git
|
||||
PKG_SOURCE_VERSION:=6e8eba62b4e50acf89681e3a67a3a693186dcd05
|
||||
PKG_MIRROR_HASH:=b6b1099c90818c5eb322bdae105d3df8d7a954d6e9ee7798c3c2412eed528640
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_MAINTAINER:=messense <messense@icloud.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=rust/host
|
||||
|
||||
RUST_PKG_FEATURES:=rustls-tls atomic64 native-tls native-tls-vendored
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../../lang/rust/rust-package.mk
|
||||
|
||||
define Package/aliyundrive-webdav
|
||||
SECTION:=multimedia
|
||||
CATEGORY:=Multimedia
|
||||
TITLE:=WebDAV server for AliyunDrive
|
||||
URL:=https://github.com/messense/aliyundrive-webdav
|
||||
DEPENDS:=$$(RUST_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/aliyundrive-webdav/description
|
||||
WebDAV server for AliyunDrive.
|
||||
endef
|
||||
|
||||
define Package/aliyundrive-webdav/conffiles
|
||||
/etc/config/aliyundrive-webdav
|
||||
endef
|
||||
|
||||
define Package/aliyundrive-webdav/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/target/$(RUSTC_TARGET_ARCH)/release/aliyundrive-webdav $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(CURDIR)/files/aliyundrive-webdav.init $(1)/etc/init.d/aliyundrive-webdav
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(CURDIR)/files/aliyundrive-webdav.config $(1)/etc/config/aliyundrive-webdav
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,aliyundrive-webdav))
|
||||
@@ -0,0 +1,21 @@
|
||||
config server
|
||||
option enable '0'
|
||||
option debug '0'
|
||||
option refresh_token ''
|
||||
option host '0.0.0.0'
|
||||
option port '8080'
|
||||
option drive_type ''
|
||||
option auth_user ''
|
||||
option auth_password ''
|
||||
option read_buffer_size '10485760'
|
||||
option upload_buffer_size '16777216'
|
||||
option cache_size '1000'
|
||||
option cache_ttl '600'
|
||||
option root '/'
|
||||
option no_trash '0'
|
||||
option read_only '0'
|
||||
option tls_cert ''
|
||||
option tls_key ''
|
||||
option skip_upload_same_size '0'
|
||||
option prefer_http_download '0'
|
||||
option redirect '1'
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=15
|
||||
|
||||
NAME=aliyundrive-webdav
|
||||
|
||||
uci_get_by_type() {
|
||||
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable=$(uci_get_by_type server enable)
|
||||
case "$enable" in
|
||||
1|on|true|yes|enabled)
|
||||
local refresh_token=$(uci_get_by_type server refresh_token)
|
||||
local auth_user=$(uci_get_by_type server auth_user)
|
||||
local auth_password=$(uci_get_by_type server auth_password)
|
||||
local read_buf_size=$(uci_get_by_type server read_buffer_size 10485760)
|
||||
local upload_buf_size=$(uci_get_by_type server upload_buffer_size 16777216)
|
||||
local cache_size=$(uci_get_by_type server cache_size 1000)
|
||||
local cache_ttl=$(uci_get_by_type server cache_ttl 600)
|
||||
local host=$(uci_get_by_type server host 127.0.0.1)
|
||||
local port=$(uci_get_by_type server port 8080)
|
||||
local root=$(uci_get_by_type server root /)
|
||||
local tls_cert=$(uci_get_by_type server tls_cert)
|
||||
local tls_key=$(uci_get_by_type server tls_key)
|
||||
local drive_type=$(uci_get_by_type server drive_type)
|
||||
|
||||
local extra_options="--auto-index"
|
||||
|
||||
case "$(uci_get_by_type server no_trash 0)" in
|
||||
1|on|true|yes|enabled)
|
||||
extra_options="$extra_options --no-trash"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
case "$(uci_get_by_type server read_only 0)" in
|
||||
1|on|true|yes|enabled)
|
||||
extra_options="$extra_options --read-only"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
case "$(uci_get_by_type server skip_upload_same_size 0)" in
|
||||
1|on|true|yes|enabled)
|
||||
extra_options="$extra_options --skip-upload-same-size"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
case "$(uci_get_by_type server prefer_http_download 0)" in
|
||||
1|on|true|yes|enabled)
|
||||
extra_options="$extra_options --prefer-http-download"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
case "$(uci_get_by_type server redirect 0)" in
|
||||
1|on|true|yes|enabled)
|
||||
extra_options="$extra_options --redirect"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
if [[ ! -z "$tls_cert" && ! -z "$tls_key" ]]; then
|
||||
extra_options="$extra_options --tls-cert $tls_cert --tls-key $tls_key"
|
||||
fi
|
||||
|
||||
if [[ ! -z "$drive_type" ]]; then
|
||||
extra_options="$extra_options --drive-type $drive_type"
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /bin/sh -c "/usr/bin/$NAME $extra_options --host $host --port $port --root $root --read-buffer-size $read_buf_size --upload-buffer-size $upload_buf_size --cache-size $cache_size --cache-ttl $cache_ttl --workdir /var/run/$NAME >>/var/log/$NAME.log 2>&1"
|
||||
procd_set_param pidfile /var/run/$NAME.pid
|
||||
procd_set_param env REFRESH_TOKEN="$refresh_token"
|
||||
[[ ! -z "$auth_user" ]] && procd_append_param env WEBDAV_AUTH_USER="$auth_user"
|
||||
[[ ! -z "$auth_password" ]] && procd_append_param env WEBDAV_AUTH_PASSWORD="$auth_password"
|
||||
case $(uci_get_by_type server debug) in
|
||||
1|on|true|yes|enabled)
|
||||
procd_append_param env RUST_LOG="aliyundrive_webdav=debug" ;;
|
||||
*) ;;
|
||||
esac
|
||||
procd_close_instance ;;
|
||||
*)
|
||||
stop_service ;;
|
||||
esac
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "aliyundrive-webdav"
|
||||
}
|
||||
Reference in new issue
Block a user