diff --git a/net/alist/Makefile b/net/alist/Makefile new file mode 100644 index 00000000..58c7ffc6 --- /dev/null +++ b/net/alist/Makefile @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2023 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=alist +PKG_VERSION:=3.35.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/alist-org/alist/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=e349a178cd41fff9b668e9d8df9ff1b407b7f6d6fd3dbb2f8a7ca9d0d5ecad55 + +PKG_LICENSE:=AGPL-3.0-only +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=no-mips16 + +GO_PKG:=github.com/alist-org/alist/v3 +GO_PKG_LDFLAGS_X:= \ + $(GO_PKG)/internal/conf.Version=$(PKG_VERSION) \ + $(GO_PKG)/internal/conf.WebVersion=$(PKG_VERSION) +ifeq ($(filter aarch64 x86_64, $(ARCH)),) + GO_PKG_EXCLUDES:=drivers/lark +endif + +include $(INCLUDE_DIR)/package.mk +include ../../lang/golang/golang-package.mk + +define Package/alist + SECTION:=net + CATEGORY:=Network + TITLE:=A file list program that supports multiple storage + URL:=https://alist.nn.ci + DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +fuse-utils +endef + +define Package/alist/description + A file list program that supports multiple storage, and supports + web browsing and webdav, powered by gin and Solidjs. +endef + +define Package/alist/conffiles +/etc/alist/ +/etc/config/alist +endef + +WEB_VERSION:=3.35.0 +WEB_FILE:=$(PKG_NAME)-web-$(WEB_VERSION).tar.gz +define Download/alist-web + URL:=https://github.com/alist-org/alist-web/releases/download/$(WEB_VERSION)/ + URL_FILE:=dist.tar.gz + FILE:=$(WEB_FILE) + HASH:=940608c2b9f64cf585ad4d241545e5f1e59e5f6e54ef8ea2c9c3a29998313fc7 +endef + +define Build/Prepare + $(call Build/Prepare/Default) + + ( \ + mkdir -p $(PKG_BUILD_DIR)/public ; \ + gzip -dc $(DL_DIR)/$(WEB_FILE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/public $(TAR_OPTIONS) ; \ + ) +endef + +ifneq ($(CONFIG_USE_MUSL),) + TARGET_CFLAGS += -D_LARGEFILE64_SOURCE +endif + +define Package/alist/install + $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) + + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/alist $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(CURDIR)/files/alist.config $(1)/etc/config/alist + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(CURDIR)/files/alist.init $(1)/etc/init.d/alist +endef + +$(eval $(call Download,alist-web)) +$(eval $(call GoBinPackage,alist)) +$(eval $(call BuildPackage,alist)) diff --git a/net/alist/files/alist.config b/net/alist/files/alist.config new file mode 100644 index 00000000..51903665 --- /dev/null +++ b/net/alist/files/alist.config @@ -0,0 +1,38 @@ + +config alist 'config' + option enabled '0' + option debug '0' + + # listen + option listen_addr '0.0.0.0' + option listen_http_port '5244' + option listen_https_port '-1' + option listen_force_https '0' + option listen_cert_file '' + option listen_key_file '' + option listen_unix_file '' + option listen_unix_file_perm '' + + # site + option site_url '' + option site_cdn '' + option site_login_expire '48' + option site_max_connections '0' + option site_tls_insecure '0' + + # database + option db_type 'sqlite3' + option db_host '' + option db_port '0' + option db_user '' + option db_pass '' + option db_name '' + option db_table_prefix 'x_' + option db_ssl_mode '' + + # log + option log_enable '1' + option log_max_size '5' + option log_max_backups '1' + option log_max_age '15' + diff --git a/net/alist/files/alist.init b/net/alist/files/alist.init new file mode 100644 index 00000000..a06e4e16 --- /dev/null +++ b/net/alist/files/alist.init @@ -0,0 +1,113 @@ +#!/bin/sh /etc/rc.common + +USE_PROCD=1 +START=99 + +CONF="alist" +PROG="/usr/bin/alist" +CONF_DIR="/etc/$CONF" +RUN_DIR="/var/run/$CONF" + +uci_json_add_boolean() { + local enabled + config_get_bool enabled "${4:-config}" "$2" "${3:-0}" + json_add_boolean "$1" "$enabled" +} + +uci_json_add_int() { + local value + config_get value "${4:-config}" "$2" "${3:-0}" + json_add_int "$1" "$value" +} + +uci_json_add_string() { + local value + config_get value "${4:-config}" "$2" $3 + json_add_string "$1" "$value" +} + +start_service() { + config_load "$CONF" + + local enabled + config_get_bool enabled "config" "enabled" "0" + [ "$enabled" -eq "1" ] || return 1 + + local jwt_secret + jwt_secret="$(jsonfilter -qi "$CONF_DIR/config.json" -e "@.jwt_secret")" + [ -n "$jwt_secret" ] || jwt_secret="$(tr -cd "a-zA-Z0-9" < "/dev/urandom" | head -c16)" + + mkdir -p "$CONF_DIR" + mkdir -p "$RUN_DIR" + + json_init + json_add_boolean "force" "1" + uci_json_add_string "site_url" "site_url" + uci_json_add_string "cdn" "site_cdn" + json_add_string "jwt_secret" "$jwt_secret" + uci_json_add_int "token_expires_in" "site_login_expire" "48" + json_add_object "database" + uci_json_add_string "type" "db_type" "sqlite3" + uci_json_add_string "host" "db_host" + uci_json_add_int "port" "db_port" + uci_json_add_string "user" "db_user" + uci_json_add_string "password" "db_pass" + uci_json_add_string "name" "db_name" + json_add_string "db_file" "$CONF_DIR/data.db" + uci_json_add_string "table_prefix" "db_table_prefix" "x_" + uci_json_add_string "ssl_mode" "db_ssl_mode" + json_close_object + json_add_object "scheme" + uci_json_add_string "address" "listen_addr" "0.0.0.0" + uci_json_add_int "http_port" "listen_http_port" "5244" + uci_json_add_int "https_port" "listen_https_port" "-1" + uci_json_add_boolean "force_https" "listen_force_https" + uci_json_add_string "cert_file" "listen_cert_file" + uci_json_add_string "key_file" "listen_key_file" + uci_json_add_string "unix_file" "listen_unix_file" + uci_json_add_string "unix_file_perm" "listen_unix_file_perm" + json_close_object + json_add_string "temp_dir" "$RUN_DIR/temp" + json_add_string "bleve_dir" "$CONF_DIR/bleve" + json_add_object "log" + uci_json_add_boolean "enable" "log_enable" "1" + json_add_string "name" "$RUN_DIR/log/alist.log" + uci_json_add_int "max_size" "log_max_size" "5" + uci_json_add_int "max_backups" "log_max_backups" "1" + uci_json_add_int "max_age" "log_max_age" "15" + json_add_boolean "compress" "0" + json_close_object + json_add_int "delayed_start" "0" + uci_json_add_int "max_connections" "site_max_connections" + uci_json_add_boolean "tls_insecure_skip_verify" "site_tls_insecure" + json_dump > "$CONF_DIR/config.json" + + local db_type + config_get db_type "config" "db_type" "sqlite3" + [ "$db_type" != "sqlite3" -o -e "$CONF_DIR/data.db" ] || "$PROG" --data "$CONF_DIR" admin set "password" 2>"/dev/null" + + procd_open_instance + procd_set_param command "$PROG" + procd_append_param command server + procd_append_param command --data "$CONF_DIR" + procd_append_param command --no-prefix + + local debug + config_get_bool debug "config" "debug" "0" + [ "$debug" -eq "0" ] || procd_append_param command --debug + + procd_set_param limits core="unlimited" + procd_set_param limits nofile="1000000 1000000" + procd_set_param respawn + [ "$debug" -eq "0" ] || procd_set_param stderr 1 + + procd_close_instance +} + +stop_service() { + rm -rf "$RUN_DIR" +} + +service_triggers() { + procd_add_reload_trigger "$CONF" +} diff --git a/net/alist/test.sh b/net/alist/test.sh new file mode 100644 index 00000000..efcb07e4 --- /dev/null +++ b/net/alist/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +alist version | grep "$PKG_VERSION" diff --git a/net/ddns-go/Makefile b/net/ddns-go/Makefile new file mode 100644 index 00000000..5b6e0283 --- /dev/null +++ b/net/ddns-go/Makefile @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2023 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ddns-go +PKG_VERSION:=6.7.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/jeessy2/ddns-go/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=02e850e10fef76fef41102f11fa5c606d77cab876056618d36663e1869496353 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=no-mips16 + +GO_PKG:=github.com/jeessy2/ddns-go/v6 +GO_PKG_LDFLAGS_X:=main.version=$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../../lang/golang/golang-package.mk + +define Package/ddns-go + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=Simple and easy-to-use Dynamic DNS client + URL:=https://github.com/jeessy2/ddns-go + DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle + USERID:=ddns-go:ddns-go +endef + +define Package/ddns-go/description + A simple and easy-to-use Dynamic DNS client with IPv6 support. + Supported backend: + - Alidns + - Baidu Cloud + - CloudFlare + - DnsPod + - GoDaddy Domains + - Google Domains + - Huawei Cloud + - Porkbun + - Custom callback +endef + +define Package/ddns-go/conffiles +/etc/config/ddns-go +/etc/ddns-go/config.yaml +endef + +define Package/ddns-go/install + $(call GoPackage/Package/Install/Bin,$(1)) + + $(INSTALL_DIR) $(1)/etc/config/ + $(INSTALL_CONF) $(CURDIR)/files/ddns-go.conf $(1)/etc/config/ddns-go + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) $(CURDIR)/files/ddns-go.init $(1)/etc/init.d/ddns-go +endef + +$(eval $(call GoBinPackage,ddns-go)) +$(eval $(call BuildPackage,ddns-go)) diff --git a/net/ddns-go/files/ddns-go.conf b/net/ddns-go/files/ddns-go.conf new file mode 100644 index 00000000..a6e6bee0 --- /dev/null +++ b/net/ddns-go/files/ddns-go.conf @@ -0,0 +1,8 @@ + +config ddns-go 'config' + option enabled '0' + option listen '[::]:9876' + option ttl '300' + option noweb '0' + option insecure '0' + diff --git a/net/ddns-go/files/ddns-go.init b/net/ddns-go/files/ddns-go.init new file mode 100644 index 00000000..8e9bde66 --- /dev/null +++ b/net/ddns-go/files/ddns-go.init @@ -0,0 +1,47 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2023 ImmortalWrt.org + +START=99 +USE_PROCD=1 + +CONF="ddns-go" +YAML="/etc/$CONF/config.yaml" +PROG="/usr/bin/$CONF" + +start_service() { + config_load "$CONF" + + local enabled + config_get_bool enabled "config" "enabled" "0" + [ "$enabled" -eq "1" ] || return 1 + + local listen ttl dns noweb insecure + config_get listen "config" "listen" "[::]:9876" + config_get ttl "config" "ttl" "300" + config_get dns "config" "dns" + config_get_bool noweb "config" "noweb" "0" + config_get_bool insecure "config" "insecure" "0" + + [ -d "${YAML%/*}" ] || mkdir -p "${YAML%/*}" + touch "$YAML" + chown ddns-go "$YAML" + + procd_open_instance "$CONF" + procd_set_param command "$PROG" + procd_append_param command -c "$YAML" + procd_append_param command -l "$listen" + procd_append_param command -f "$ttl" + [ -z "$dns" ] || procd_append_param command -dns "$dns" + [ "$noweb" -eq "0" ] || procd_append_param command -noweb + [ "$insecure" -eq "0" ] || procd_append_param command -skipVerify + + procd_set_param respawn + procd_set_param stderr 1 + procd_set_param user ddns-go + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "$CONF" +} diff --git a/net/lucky/Makefile b/net/lucky/Makefile new file mode 100644 index 00000000..68898edb --- /dev/null +++ b/net/lucky/Makefile @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021-2022 sirpdboy +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lucky +PKG_VERSION:=2.10.8 +PKG_RELEASE:=1 + +ifeq ($(ARCH),mipsel) + LUCKY_ARCH:=mipsle_softfloat +endif +ifeq ($(ARCH),mips) + LUCKY_ARCH:=mips_softfloat +endif +ifeq ($(ARCH),arm) + LUCKY_ARCH:=armv5 +endif +ifeq ($(BOARD),kirkwood) + LUCKY_ARCH:=armv5 +endif +ifeq ($(ARCH),armv7) + LUCKY_ARCH:=armv7 +endif +ifeq ($(ARCH),aarch64) + LUCKY_ARCH:=arm64 +endif +ifeq ($(ARCH),arm64) + LUCKY_ARCH:=arm64 +endif +ifeq ($(ARCH),armv8) + LUCKY_ARCH:=arm64 +endif +ifeq ($(ARCH),i386) + LUCKY_ARCH:=i386 +endif +ifeq ($(ARCH),x86_64) + LUCKY_ARCH:=x86_64 +endif + +PKG_LICENSE:=GPL-3.0-only +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=GDY666 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=3626928d4a45ae606856b834614e45997b5da235 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + TITLE:=Lucky dynamic domain name ddns-go service, socat,frp + DEPENDS:=@(i386||x86_64||arm||aarch64||mipsel||mips) + URL:=https://github.com/gdy666/lucky +endef + +define Package/$(PKG_NAME)/description + Main functions of Lucky: dynamic domain name ddns-go service, socat,reverse proxy ,wake on lan +endef + +define Build/Prepare + [ ! -f $(PKG_BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)_Linux_$(LUCKY_ARCH).tar.gz ] && wget https://github.com/gdy666/lucky/releases/download/v$(PKG_VERSION)/$(PKG_NAME)_$(PKG_VERSION)_Linux_$(LUCKY_ARCH).tar.gz -O $(PKG_BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)_Linux_$(LUCKY_ARCH).tar.gz + tar -xzvf $(PKG_BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)_Linux_$(LUCKY_ARCH).tar.gz -C $(PKG_BUILD_DIR) +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lucky $(1)/usr/bin/lucky +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/utils/cpulimit/Makefile b/utils/cpulimit/Makefile new file mode 100644 index 00000000..ae81e249 --- /dev/null +++ b/utils/cpulimit/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=cpulimit +PKG_VERSION:=0.3.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/denji/cpulimit/tar.gz/$(PKG_VERSION)? +PKG_HASH:=0c61d394407fdd0547b53e6435ecb817d2e3ba914b48aa9f48ccf42c8278d3a6 + +PKG_BUILD_PARALLEL:=1 +PKG_LICENSE_FILES:=LICENSE + +MAKE_PATH:=src + +include $(INCLUDE_DIR)/package.mk + +define Package/cpulimit + SECTION:=utils + CATEGORY:=Utilities + TITLE:=CPU usage limiter + URL:=https://github.com/denji/cpulimit +endef + +define Package/cpulimit/description + Cpulimit is a tool which limits the CPU usage of a process + (expressed in percentage, not in CPU time). +endef + +define Package/cpulimit/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cpulimit $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,cpulimit))