refactor: Update podkop package

* Removed direct package manager calls
* Removed commands related to optional luci package
* Added optional parameter for global_check for cases when function called by LuCI package
* Removed useless external calls in version check cases
* Improved build process support: version will be automatically set at installation time from package metadata and will be readable from script itself
This commit is contained in:
SaltyMonkey
2025-10-08 21:57:46 +03:00
parent b89fe33296
commit 6ff543d7fb
3 changed files with 11 additions and 16 deletions

View File

@@ -48,7 +48,6 @@ endef
define Package/podkop/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/podkop $(1)/etc/init.d/podkop
sed -i "s/VERSION_FROM_MAKEFILE/$(PKG_VERSION)/g" $(1)/etc/init.d/podkop
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/podkop $(1)/etc/config/podkop
@@ -58,6 +57,8 @@ define Package/podkop/install
$(INSTALL_DIR) $(1)/usr/lib/podkop
$(CP) ./files/usr/lib/* $(1)/usr/lib/podkop/
sed -i -e 's/__COMPILED_VERSION_VARIABLE__/$(PKG_VERSION)/g' $(1)/usr/lib/podkop/constants.sh
endef
$(eval $(call BuildPackage,podkop))

View File

@@ -1784,13 +1784,7 @@ show_config() {
}
show_version() {
local version=$(opkg list-installed podkop | awk '{print $3}')
echo "$version"
}
show_luci_version() {
local version=$(opkg list-installed luci-app-podkop | awk '{print $3}')
echo "$version"
echo "$PODKOP_VERSION"
}
show_sing_box_version() {
@@ -1967,11 +1961,14 @@ find_working_resolver() {
}
global_check() {
local PODKOP_LUCI_VERSION="Unknown"
[ -n "$1" ] && PODKOP_LUCI_VERSION="$1"
print_global "📡 Global check run!"
print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print_global "🛠️ System info"
print_global "🕳️ Podkop: $(opkg list-installed podkop | awk '{print $3}')"
print_global "🕳️ LuCI App: $(opkg list-installed luci-app-podkop | awk '{print $3}')"
print_global "🕳️ Podkop: ${PODKOP_VERSION}"
print_global "🕳️ LuCI App: ${PODKOP_LUCI_VERSION}"
print_global "📦 Sing-box: $(sing-box version | head -n 1 | awk '{print $3}')"
print_global "🛜 OpenWrt: $(grep OPENWRT_RELEASE /etc/os-release | cut -d'"' -f2)"
print_global "🛜 Device: $(cat /tmp/sysinfo/model)"
@@ -2133,7 +2130,6 @@ Available commands:
show_config Display current podkop configuration
show_version Show podkop version
show_sing_box_config Show sing-box configuration
show_luci_version Show LuCI app version
show_sing_box_version Show sing-box version
show_system_info Show system information
get_status Get podkop service status
@@ -2192,9 +2188,6 @@ show_version)
show_sing_box_config)
show_sing_box_config
;;
show_luci_version)
show_luci_version
;;
show_sing_box_version)
show_sing_box_version
;;
@@ -2211,10 +2204,10 @@ check_dns_available)
check_dns_available
;;
global_check)
global_check
global_check "${2:-}"
;;
*)
show_help
exit 1
;;
esac
esac

View File

@@ -1,5 +1,6 @@
# shellcheck disable=SC2034
PODKOP_VERSION="__COMPILED_VERSION_VARIABLE__"
## Common
PODKOP_CONFIG="/etc/config/podkop"
RESOLV_CONF="/etc/resolv.conf"