mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-13 20:08:05 +08:00
🗽 Sync 2026-10-23 00:46:23
This commit is contained in:
1 parent
6032a57538
commit
2b29b0c4e1
112 files changed
+1859
-6208
No files matched your search
+30
-13
@@ -6,28 +6,42 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_ARCH_kaiplus:=$(ARCH)
|
||||
KAIPLUS_ARCH_x86_64:=amd64
|
||||
KAIPLUS_ARCH_aarch64:=arm64
|
||||
KAIPLUS_ARCH:=$(KAIPLUS_ARCH_$(ARCH))
|
||||
|
||||
KAIPLUS_HASH_x86_64:=5588a5e1b7874bc5e631ab8ff1288226f567a84d3115808f22352d142c40f5d6
|
||||
KAIPLUS_HASH_aarch64:=5be29e4715a1181937c0156a6954738ce96fde2f338a1b03cd32c68b00e61524
|
||||
|
||||
PKG_NAME:=kaiplus
|
||||
PKG_VERSION:=1.0.9
|
||||
PKG_RELEASE:=14
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/istoreos/istoreos-app-hub/releases/download/kaiplus-runtime-v$(PKG_VERSION)/
|
||||
PKG_HASH:=skip
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
||||
PKG_RELEASE:=15
|
||||
|
||||
KAIPLUS_URL_FILE:=kaiplus-linux-$(KAIPLUS_ARCH)
|
||||
KAIPLUS_DOWNLOAD:=$(KAIPLUS_URL_FILE)-$(KAIPLUS_HASH_$(ARCH))
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
STRIP:=true
|
||||
RSTRIP:=:
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Download/kaiplus
|
||||
URL:=https://fw.koolcenter.com/binary/kai/releases/build/
|
||||
URL_FILE:=$(KAIPLUS_URL_FILE)
|
||||
FILE:=$(KAIPLUS_DOWNLOAD)
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=System
|
||||
SUBMENU:=
|
||||
TITLE:=KaiPlus
|
||||
URL:=https://github.com/linkease/istore-packages
|
||||
DEPENDS:=+linkease-app-entry
|
||||
DEPENDS:=@(x86_64||aarch64) +linkease-app-entry
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
@@ -51,6 +65,11 @@ fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(INSTALL_DIR) $(PKG_BUILD_DIR)
|
||||
$(CP) $(DL_DIR)/$(KAIPLUS_DOWNLOAD) $(PKG_BUILD_DIR)/kaiplus
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
@@ -58,12 +77,9 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/kaiplus/www $(1)/usr/share/kaiplus/defaults $(1)/usr/share/kaiplus/helpers $(1)/usr/share/linkease/apps.d $(1)/usr/share/linkeasefull/desktop-apps.d $(1)/etc/init.d $(1)/etc/config
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/kaiplus_bin.$(PKG_ARCH_kaiplus) $(1)/usr/sbin/kaiplus_bin
|
||||
$(CP) $(PKG_BUILD_DIR)/www/* $(1)/usr/share/kaiplus/www/
|
||||
$(INSTALL_DATA) ./files/logo.png $(1)/usr/share/kaiplus/www/logo.png
|
||||
$(CP) $(PKG_BUILD_DIR)/defaults/* $(1)/usr/share/kaiplus/defaults/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helpers/kaiplus_workspace_tool.* $(1)/usr/share/kaiplus/helpers/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/kaiplus $(1)/usr/share/linkease/apps.d $(1)/usr/share/linkeasefull/desktop-apps.d $(1)/etc/init.d $(1)/etc/config
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/kaiplus $(1)/usr/sbin/kaiplus
|
||||
$(INSTALL_DATA) ./files/logo.png $(1)/usr/share/kaiplus/logo.png
|
||||
$(INSTALL_DATA) ./files/kaiplus-plugin.json $(1)/usr/share/kaiplus/kaiplus-plugin.json
|
||||
ln -sf /usr/share/kaiplus/kaiplus-plugin.json $(1)/usr/share/linkeasefull/desktop-apps.d/00-kaiplus-plugin.json
|
||||
ln -sf /usr/share/kaiplus/kaiplus-plugin.json $(1)/usr/share/linkease/apps.d/00-kaiplus-plugin.json
|
||||
@@ -71,4 +87,5 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_CONF) ./files/kaiplus.config $(1)/etc/config/kaiplus
|
||||
endef
|
||||
|
||||
$(eval $(call Download,kaiplus))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -3,16 +3,19 @@
|
||||
"id": "kaiplus",
|
||||
"name": "KaiPlus",
|
||||
"icon": "logo.png",
|
||||
"staticRoot": "/usr/share/kaiplus/www",
|
||||
"staticRoot": "/usr/share/kaiplus",
|
||||
"desktop": {
|
||||
"mode": "module",
|
||||
"entry": "desktop-entry.js",
|
||||
"isolation": "shadow-dom"
|
||||
},
|
||||
"standalone": {
|
||||
"entry": "index.html",
|
||||
"basePath": "/apps/kaiplus/",
|
||||
"url": "/apps/kaiplus/"
|
||||
"url": "/apps/kaiplus/",
|
||||
"externalOpen": {
|
||||
"enabled": true,
|
||||
"label": "在浏览器中打开酷友社AI"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"providerOrder": ["uci"],
|
||||
@@ -24,42 +27,14 @@
|
||||
},
|
||||
"backend": {
|
||||
"type": "http",
|
||||
"transport": "unix",
|
||||
"scheme": "http",
|
||||
"values": {
|
||||
"socketPath": {
|
||||
"default": "/var/run/kaiplus.sock",
|
||||
"keys": {
|
||||
"uci": "kaiplus.@kaiplus[0].socket_path"
|
||||
}
|
||||
},
|
||||
"listenMode": {
|
||||
"default": "auto",
|
||||
"keys": {
|
||||
"uci": "kaiplus.@kaiplus[0].listen_mode"
|
||||
}
|
||||
},
|
||||
"externalPortEnabled": {
|
||||
"default": false,
|
||||
"keys": {
|
||||
"uci": "kaiplus.@kaiplus[0].external_port_enabled"
|
||||
}
|
||||
},
|
||||
"port": {
|
||||
"default": 8189,
|
||||
"keys": {
|
||||
"uci": "kaiplus.@kaiplus[0].port"
|
||||
}
|
||||
}
|
||||
},
|
||||
"host": "127.0.0.1",
|
||||
"portFromUci": "kaiplus.@kaiplus[0].port",
|
||||
"defaultPort": 8189,
|
||||
"upstreamBasePath": "/apps/kaiplus/",
|
||||
"apiPath": "api/",
|
||||
"pathMode": "preserve",
|
||||
"fallback": {
|
||||
"transport": "tcp",
|
||||
"scheme": "http",
|
||||
"host": "127.0.0.1"
|
||||
}
|
||||
"proxyMode": "app-base"
|
||||
},
|
||||
"window": {
|
||||
"width": 1180,
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
config kaiplus
|
||||
option 'enabled' '0'
|
||||
option 'data_dir' ''
|
||||
option 'listen_mode' 'auto'
|
||||
option 'external_port_enabled' '0'
|
||||
option 'socket_path' '/var/run/kaiplus.sock'
|
||||
option 'port' '8189'
|
||||
option 'bind_addr' '0.0.0.0'
|
||||
option 'base_path' '/apps/kaiplus/'
|
||||
option 'system_role' 'istoreos'
|
||||
option 'release_channel' 'stable'
|
||||
option 'auth_mode' 'disabled'
|
||||
+16
-65
@@ -6,15 +6,7 @@ USE_PROCD=1
|
||||
get_config() {
|
||||
config_get_bool enabled "$1" enabled 0
|
||||
config_get data_dir "$1" data_dir ""
|
||||
config_get listen_mode "$1" listen_mode "auto"
|
||||
config_get_bool external_port_enabled "$1" external_port_enabled 0
|
||||
config_get socket_path "$1" socket_path "/var/run/kaiplus.sock"
|
||||
config_get port "$1" port "8189"
|
||||
config_get bind_addr "$1" bind_addr "0.0.0.0"
|
||||
config_get base_path "$1" base_path "/apps/kaiplus/"
|
||||
config_get system_role "$1" system_role "istoreos"
|
||||
config_get release_channel "$1" release_channel "stable"
|
||||
config_get auth_mode "$1" auth_mode "disabled"
|
||||
}
|
||||
|
||||
mkdir_p() {
|
||||
@@ -26,7 +18,7 @@ start_service() {
|
||||
config_foreach get_config kaiplus
|
||||
|
||||
if [ "$enabled" != 1 ]; then
|
||||
return 1
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$data_dir" ]; then
|
||||
logger -t kaiplus "data_dir is empty; please set option data_dir in /etc/config/kaiplus"
|
||||
@@ -41,64 +33,23 @@ start_service() {
|
||||
mkdir_p "$data_dir/state"
|
||||
chmod 0700 "$data_dir/config" "$data_dir/state"
|
||||
|
||||
helper_token_file="$data_dir/state/ssh-helper.token"
|
||||
if [ ! -s "$helper_token_file" ]; then
|
||||
umask 077
|
||||
if [ -r /proc/sys/kernel/random/uuid ]; then
|
||||
cat /proc/sys/kernel/random/uuid > "$helper_token_file"
|
||||
else
|
||||
{
|
||||
date +%s
|
||||
cat /proc/uptime 2>/dev/null
|
||||
dd if=/dev/urandom bs=24 count=1 2>/dev/null || true
|
||||
} | sha256sum | awk '{print $1}' > "$helper_token_file"
|
||||
fi
|
||||
fi
|
||||
helper_token="$(cat "$helper_token_file")"
|
||||
|
||||
logger -t kaiplus "Starting KaiPlus service"
|
||||
procd_open_instance kaiplus_bin
|
||||
if [ "$listen_mode" = "tcp" ] || [ "$external_port_enabled" = 1 ]; then
|
||||
procd_set_param env \
|
||||
KAIPLUS_HOME="$data_dir" \
|
||||
KAIPLUS_SYSTEM_ROLE="$system_role" \
|
||||
KAIPLUS_RELEASE_CHANNEL="$release_channel" \
|
||||
KAIPLUS_AUTH_MODE="$auth_mode" \
|
||||
LINKEASE_AUTH_PROVIDER="$auth_mode" \
|
||||
KAIPLUS_LISTEN_MODE="tcp" \
|
||||
KAIPLUS_WORKSPACE_HELPER_DIR="/usr/share/kaiplus/helpers" \
|
||||
KAIPLUS_WORKSPACE_TOOL_INSTALL_DIR="/tmp/kaiplus_workspace_tool" \
|
||||
KAIPLUS_SSH_HELPER_TOKEN="$helper_token" \
|
||||
REASONIX_CREDENTIALS_STORE="file"
|
||||
else
|
||||
mkdir_p "$(dirname "$socket_path")"
|
||||
procd_set_param env \
|
||||
KAIPLUS_HOME="$data_dir" \
|
||||
KAIPLUS_SYSTEM_ROLE="$system_role" \
|
||||
KAIPLUS_RELEASE_CHANNEL="$release_channel" \
|
||||
KAIPLUS_AUTH_MODE="$auth_mode" \
|
||||
LINKEASE_AUTH_PROVIDER="$auth_mode" \
|
||||
KAIPLUS_LISTEN_MODE="unix" \
|
||||
KAIPLUS_SOCKET_PATH="$socket_path" \
|
||||
KAIPLUS_WORKSPACE_HELPER_DIR="/usr/share/kaiplus/helpers" \
|
||||
KAIPLUS_WORKSPACE_TOOL_INSTALL_DIR="/tmp/kaiplus_workspace_tool" \
|
||||
KAIPLUS_SSH_HELPER_TOKEN="$helper_token" \
|
||||
REASONIX_CREDENTIALS_STORE="file"
|
||||
fi
|
||||
procd_set_param command /usr/sbin/kaiplus_bin kaiplus-web
|
||||
if [ "$listen_mode" = "tcp" ] || [ "$external_port_enabled" = 1 ]; then
|
||||
procd_append_param command --listen-mode tcp
|
||||
procd_append_param command --addr "$bind_addr:$port"
|
||||
else
|
||||
procd_append_param command --listen-mode unix
|
||||
procd_append_param command --socket-path "$socket_path"
|
||||
fi
|
||||
procd_open_instance kaiplus
|
||||
procd_set_param env \
|
||||
KAIPLUS_HOME="$data_dir" \
|
||||
KAIPLUS_SYSTEM_ROLE="istoreos" \
|
||||
KAIPLUS_RELEASE_CHANNEL="stable" \
|
||||
KAIPLUS_AUTH_MODE="openwrt_luci" \
|
||||
LINKEASE_AUTH_PROVIDER="openwrt_luci" \
|
||||
KAIPLUS_LISTEN_MODE="tcp" \
|
||||
REASONIX_CREDENTIALS_STORE="file"
|
||||
procd_set_param command /usr/sbin/kaiplus kaiplus-web
|
||||
procd_append_param command --listen-mode tcp
|
||||
procd_append_param command --addr "0.0.0.0:$port"
|
||||
procd_append_param command --data-dir "$data_dir"
|
||||
procd_append_param command --static-dir /usr/share/kaiplus/www
|
||||
procd_append_param command --defaults-dir /usr/share/kaiplus/defaults
|
||||
procd_append_param command --base-path "$base_path"
|
||||
procd_append_param command --system-role "$system_role"
|
||||
procd_append_param command --release-channel "$release_channel"
|
||||
procd_append_param command --base-path /apps/kaiplus/
|
||||
procd_append_param command --system-role istoreos
|
||||
procd_append_param command --release-channel stable
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
|
||||
Reference in new issue
Block a user