Add alist-v2.0.7 package
This commit is contained in:
parent
30a4c8d40b
commit
915f73d974
99
alist/Makefile
Normal file
99
alist/Makefile
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2015-2016 OpenWrt.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=alist
|
||||||
|
PKG_VERSION:=2.0.7
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/Xhofe/alist/tar.gz/v$(PKG_VERSION)?
|
||||||
|
PKG_HASH:=87793a683362fb16133879f5f20384b47f650b82dc074948283405986854a382
|
||||||
|
|
||||||
|
PKG_LICENSE:=GPL-3.0
|
||||||
|
PKG_LICENSE_FILE:=LICENSE
|
||||||
|
PKG_MAINTAINER:=sbwml <admin@cooluc.com>
|
||||||
|
|
||||||
|
PKG_CONFIG_DEPENDS:=CONFIG_ALIST_COMPRESS_UPX
|
||||||
|
|
||||||
|
PKG_BUILD_DEPENDS:=golang/host node/host node-yarn/host
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_USE_MIPS16:=0
|
||||||
|
|
||||||
|
GO_PKG:=github.com/Xhofe/alist
|
||||||
|
ALIST_PKG:=github.com/Xhofe/alist/conf
|
||||||
|
GO_PKG_LDFLAGS:=-w -s
|
||||||
|
GO_PKG_LDFLAGS_X:=$(ALIST_PKG).GitTag=v$(PKG_VERSION)-$(ARCH)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/Default
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
SUBMENU:=Web Servers/Proxies
|
||||||
|
TITLE:=Alist - Main program
|
||||||
|
URL:=https://alist-doc.nn.ci/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/description
|
||||||
|
A file list program that supports multiple storage
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)
|
||||||
|
$(call Package/alist/Default)
|
||||||
|
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/config
|
||||||
|
config ALIST_COMPRESS_UPX
|
||||||
|
bool "Compress executable files with UPX"
|
||||||
|
default y
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/conffiles
|
||||||
|
/etc/alist/
|
||||||
|
/etc/config/alist
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
|
[ -f /etc/uci-defaults/alist ] && /etc/uci-defaults/alist && rm -f /etc/uci-defaults/alist
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
$(call Build/Prepare/Default)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
( \
|
||||||
|
pushd $(PKG_BUILD_DIR) ; \
|
||||||
|
curl -o alist-web-$(PKG_VERSION).tar.gz https://codeload.github.com/alist-org/alist-web/tar.gz/refs/tags/$(PKG_VERSION) ; \
|
||||||
|
tar -zxvf alist-web-$(PKG_VERSION).tar.gz ; \
|
||||||
|
cd alist-web-$(PKG_VERSION) ; \
|
||||||
|
yarn && yarn build ; \
|
||||||
|
cp -ax dist/* ../public/ ; \
|
||||||
|
popd ; \
|
||||||
|
$(call GoPackage/Build/Compile) ; \
|
||||||
|
)
|
||||||
|
ifneq ($(CONFIG_ALIST_COMPRESS_UPX),)
|
||||||
|
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/alist
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/alist $(1)/etc/config $(1)/etc/init.d $(1)/etc/uci-defaults
|
||||||
|
$(call GoPackage/Package/Install/Bin,$(1))
|
||||||
|
$(INSTALL_CONF) ./files/alist.config $(1)/etc/config/alist
|
||||||
|
$(INSTALL_BIN) ./files/alist.init $(1)/etc/init.d/alist
|
||||||
|
$(INSTALL_BIN) ./files/alist.uci-default $(1)/etc/uci-defaults/alist
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call GoBinPackage,$(PKG_NAME)))
|
||||||
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
5
alist/files/alist.config
Normal file
5
alist/files/alist.config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
config alist
|
||||||
|
option 'enabled' '1'
|
||||||
|
option 'port' '5244'
|
||||||
|
option 'expiration' '60'
|
||||||
|
option 'cleanup_interval' '120'
|
36
alist/files/alist.init
Executable file
36
alist/files/alist.init
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=99
|
||||||
|
USE_PROCD=1
|
||||||
|
PROG=/usr/bin/alist
|
||||||
|
CONFIG=/etc/alist/config.json
|
||||||
|
|
||||||
|
get_config() {
|
||||||
|
config_get_bool enabled $1 enabled 1
|
||||||
|
config_get port $1 port 5244
|
||||||
|
config_get expiration $1 expiration 60
|
||||||
|
config_get cleanup_interval $1 cleanup_interval 120
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
config_load alist
|
||||||
|
config_foreach get_config alist
|
||||||
|
[ $enabled != 1 ] && return 1
|
||||||
|
cat > $CONFIG <<EOF
|
||||||
|
{"address":"0.0.0.0","port":$port,"assets":"","database":{"type":"sqlite3","user":"","password":"","host":"","port":0,"name":"","table_prefix":"x_","db_file":"/etc/alist/data.db","ssl_mode":"disable"},"scheme":{"https":false,"cert_file":"","key_file":""},"cache":{"expiration":$expiration,"cleanup_interval":$cleanup_interval}}
|
||||||
|
EOF
|
||||||
|
procd_open_instance
|
||||||
|
procd_set_param command $PROG
|
||||||
|
procd_append_param command --conf $CONFIG
|
||||||
|
procd_set_param respawn
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "alist"
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
22
alist/files/alist.uci-default
Executable file
22
alist/files/alist.uci-default
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
delete ucitrack.@alist[-1]
|
||||||
|
add ucitrack alist
|
||||||
|
set ucitrack.@alist[-1].init=alist
|
||||||
|
commit ucitrack
|
||||||
|
|
||||||
|
delete firewall.alist
|
||||||
|
set firewall.alist=rule
|
||||||
|
set firewall.alist.name="alist"
|
||||||
|
set firewall.alist.target="ACCEPT"
|
||||||
|
set firewall.alist.src="wan"
|
||||||
|
set firewall.alist.proto="tcp"
|
||||||
|
set firewall.alist.dest_port="5244"
|
||||||
|
commit firewall
|
||||||
|
EOF
|
||||||
|
|
||||||
|
/etc/init.d/alist enable
|
||||||
|
/etc/init.d/alist start
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user