add config and entry for istoreenhance (#537)

add config and entry for istoreenhance (#537)

  • add config and entry

  • add meta autoconfig

  • add useless cache dir

  • fix error

  • create config paths default

  • bump version


Co-authored-by: Jason <xiaobao@linkease.com>
diff --git a/applications/app-meta-istoreenhance/Makefile b/applications/app-meta-istoreenhance/Makefile
index b519707..44b420a 100644
--- a/applications/app-meta-istoreenhance/Makefile
+++ b/applications/app-meta-istoreenhance/Makefile
@@ -2,7 +2,7 @@
 
 include $(TOPDIR)/rules.mk
 
-PKG_VERSION:=0.3.3
+PKG_VERSION:=0.3.7
 PKG_RELEASE:=1
 META_TITLE:=KSpeeder(原iStore增强)
 META_TITLE.en:=KSpeeder(iStoreEnhance)
@@ -15,6 +15,8 @@ META_TAGS:=nas service
 META_LUCI_ENTRY:=/cgi-bin/luci/admin/services/istoreenhance
 META_WEBSITE:=https://kspeeder.com/
 META_TUTORIAL:=https://kspeeder.com/guide/getting-started.html
+META_AUTOCONF:=path enable
+META_UCI:=istoreenhance
 
 include ../../meta.mk
 
diff --git a/applications/app-meta-istoreenhance/config.sh b/applications/app-meta-istoreenhance/config.sh
new file mode 100755
index 0000000..6b21e91
--- /dev/null
+++ b/applications/app-meta-istoreenhance/config.sh
@@ -0,0 +1,22 @@
+
+[ -z "$ISTORE_CONF_DIR" ] && exit 1
+
+ENABLED=1
+ISTORE_ACTION=start
+if [ -n "$ISTORE_DONT_START" ]; then
+    ENABLED=0
+    ISTORE_ACTION=stop
+fi
+
+uci -q batch <<-EOF >/dev/null || exit 1
+    mkdir $ISTORE_CONF_DIR/iStoreEnhance
+    set istoreenhance.@istoreenhance[0].enabled=$ENABLED
+    set istoreenhance.@istoreenhance[0].cache='$ISTORE_CONF_DIR/iStoreEnhance'
+    commit istoreenhance
+EOF
+
+if [ -f /etc/init.d/istoreenhance ]; then
+    /etc/init.d/istoreenhance $ISTORE_ACTION || [ stop = $ISTORE_ACTION ]
+else
+    /etc/init.d/istoreenhance $ISTORE_ACTION || [ stop = $ISTORE_ACTION ]
+fi
diff --git a/applications/app-meta-istoreenhance/entry.sh b/applications/app-meta-istoreenhance/entry.sh
new file mode 100755
index 0000000..6375402
--- /dev/null
+++ b/applications/app-meta-istoreenhance/entry.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+ISTOREENHANCE_BIN=/usr/sbin/iStoreEnhance
+
+status(){
+    local host="$1"
+    [ -n "$host" ] || host=127.0.0.1
+    . /usr/share/libubox/jshn.sh
+    json_init
+    json_add_string "app" "istoreenhance"
+    json_add_boolean "docker" "0"
+
+    if [ -x "$ISTOREENHANCE_BIN" ]; then
+        json_add_boolean "running" "1"
+        local port=$(uci get istoreenhance.@istoreenhance[0].adminport 2>/dev/null)
+        local portsec=${port:-5003}
+        json_add_string "web" ":${portsec}"
+        json_add_string "href" "http://$host:${portsec}/"
+        json_add_string "protocol" http
+        json_add_string "port" "${portsec}"
+        json_add_boolean "deployed" "1"
+    else
+        json_add_boolean "running" "0"
+        json_add_boolean "deployed" "0"
+    fi
+
+    json_dump
+    json_cleanup >/dev/null
+}
+
+start(){
+    echo "Start not supported for iStoreEnhance" >&2
+    /etc/init.d/istoreenhance start
+    return 0
+}
+
+stop(){
+    echo "Stop not supported for iStoreEnhance" >&2
+    /etc/init.d/istoreenhance stop
+    return 0
+}
+
+ACTION=${1}
+shift 1
+[ -z "${ACTION}" ] && ACTION=help
+
+case ${ACTION} in
+  "status" | "start" | "stop")
+    ${ACTION} "$@"
+  ;;
+  *)
+    echo "Unknown Action" >&2
+    exit 1
+  ;;
+esac

GitHub
sha: 580ebc09a2f35aa7b40f4689489b2d7f69f08bf6