mirror of
https://github.com/itdoginfo/podkop.git
synced 2026-01-31 06:40:46 +03:00
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:
@@ -48,7 +48,6 @@ endef
|
|||||||
define Package/podkop/install
|
define Package/podkop/install
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/podkop $(1)/etc/init.d/podkop
|
$(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_DIR) $(1)/etc/config
|
||||||
$(INSTALL_CONF) ./files/etc/config/podkop $(1)/etc/config/podkop
|
$(INSTALL_CONF) ./files/etc/config/podkop $(1)/etc/config/podkop
|
||||||
@@ -58,6 +57,8 @@ define Package/podkop/install
|
|||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/podkop
|
$(INSTALL_DIR) $(1)/usr/lib/podkop
|
||||||
$(CP) ./files/usr/lib/* $(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
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,podkop))
|
$(eval $(call BuildPackage,podkop))
|
||||||
|
|||||||
@@ -1784,13 +1784,7 @@ show_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_version() {
|
show_version() {
|
||||||
local version=$(opkg list-installed podkop | awk '{print $3}')
|
echo "$PODKOP_VERSION"
|
||||||
echo "$version"
|
|
||||||
}
|
|
||||||
|
|
||||||
show_luci_version() {
|
|
||||||
local version=$(opkg list-installed luci-app-podkop | awk '{print $3}')
|
|
||||||
echo "$version"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show_sing_box_version() {
|
show_sing_box_version() {
|
||||||
@@ -1967,11 +1961,14 @@ find_working_resolver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
global_check() {
|
global_check() {
|
||||||
|
local PODKOP_LUCI_VERSION="Unknown"
|
||||||
|
[ -n "$1" ] && PODKOP_LUCI_VERSION="$1"
|
||||||
|
|
||||||
print_global "📡 Global check run!"
|
print_global "📡 Global check run!"
|
||||||
print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
print_global "🛠️ System info"
|
print_global "🛠️ System info"
|
||||||
print_global "🕳️ Podkop: $(opkg list-installed podkop | awk '{print $3}')"
|
print_global "🕳️ Podkop: ${PODKOP_VERSION}"
|
||||||
print_global "🕳️ LuCI App: $(opkg list-installed luci-app-podkop | awk '{print $3}')"
|
print_global "🕳️ LuCI App: ${PODKOP_LUCI_VERSION}"
|
||||||
print_global "📦 Sing-box: $(sing-box version | head -n 1 | awk '{print $3}')"
|
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 "🛜 OpenWrt: $(grep OPENWRT_RELEASE /etc/os-release | cut -d'"' -f2)"
|
||||||
print_global "🛜 Device: $(cat /tmp/sysinfo/model)"
|
print_global "🛜 Device: $(cat /tmp/sysinfo/model)"
|
||||||
@@ -2133,7 +2130,6 @@ Available commands:
|
|||||||
show_config Display current podkop configuration
|
show_config Display current podkop configuration
|
||||||
show_version Show podkop version
|
show_version Show podkop version
|
||||||
show_sing_box_config Show sing-box configuration
|
show_sing_box_config Show sing-box configuration
|
||||||
show_luci_version Show LuCI app version
|
|
||||||
show_sing_box_version Show sing-box version
|
show_sing_box_version Show sing-box version
|
||||||
show_system_info Show system information
|
show_system_info Show system information
|
||||||
get_status Get podkop service status
|
get_status Get podkop service status
|
||||||
@@ -2192,9 +2188,6 @@ show_version)
|
|||||||
show_sing_box_config)
|
show_sing_box_config)
|
||||||
show_sing_box_config
|
show_sing_box_config
|
||||||
;;
|
;;
|
||||||
show_luci_version)
|
|
||||||
show_luci_version
|
|
||||||
;;
|
|
||||||
show_sing_box_version)
|
show_sing_box_version)
|
||||||
show_sing_box_version
|
show_sing_box_version
|
||||||
;;
|
;;
|
||||||
@@ -2211,7 +2204,7 @@ check_dns_available)
|
|||||||
check_dns_available
|
check_dns_available
|
||||||
;;
|
;;
|
||||||
global_check)
|
global_check)
|
||||||
global_check
|
global_check "${2:-}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
show_help
|
show_help
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
|
PODKOP_VERSION="__COMPILED_VERSION_VARIABLE__"
|
||||||
## Common
|
## Common
|
||||||
PODKOP_CONFIG="/etc/config/podkop"
|
PODKOP_CONFIG="/etc/config/podkop"
|
||||||
RESOLV_CONF="/etc/resolv.conf"
|
RESOLV_CONF="/etc/resolv.conf"
|
||||||
|
|||||||
Reference in New Issue
Block a user