Use podkop-plus UCI config namespace
This commit is contained in:
@@ -68,7 +68,7 @@ body:
|
||||
Релевантные части конфигурации (удалите чувствительную информацию!)
|
||||
placeholder: |
|
||||
Например:
|
||||
- Содержимое /etc/config/podkop
|
||||
- Содержимое /etc/config/podkop-plus
|
||||
- Конфигурация sing-box (если релевантно)
|
||||
- Дополнительные конфиги, которые потребуются wireless/network/dhcp и т.д.
|
||||
render: shell
|
||||
|
||||
@@ -4,7 +4,7 @@ export const STATUS_COLORS = {
|
||||
WARNING: '#ff9800',
|
||||
};
|
||||
|
||||
export const PODKOP_UCI_PACKAGE = 'podkop_plus';
|
||||
export const PODKOP_UCI_PACKAGE = 'podkop-plus';
|
||||
export const PODKOP_LUCI_VIEW_NAMESPACE = 'podkop_plus';
|
||||
export const PODKOP_LUCI_VIEW_DIR = `/www/luci-static/resources/view/${PODKOP_LUCI_VIEW_NAMESPACE}`;
|
||||
export const PODKOP_LUCI_I18N_DOMAIN = 'podkop_plus';
|
||||
|
||||
+20
-12
@@ -447,7 +447,15 @@ is_original_podkop_present() {
|
||||
}
|
||||
|
||||
migrate_podkop_plus_config_if_needed() {
|
||||
[ -f /etc/config/podkop_plus ] && return 0
|
||||
[ -f /etc/config/podkop-plus ] && return 0
|
||||
|
||||
if [ -f /etc/config/podkop_plus ]; then
|
||||
cp /etc/config/podkop_plus /etc/config/podkop-plus || fail "Failed to migrate the Podkop Plus config to /etc/config/podkop-plus"
|
||||
chmod 0644 /etc/config/podkop-plus || true
|
||||
msg "Migrated the Podkop Plus config to /etc/config/podkop-plus"
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ -f /etc/config/podkop ] || return 0
|
||||
|
||||
if ! pkg_is_installed "luci-app-podkop-plus" &&
|
||||
@@ -459,14 +467,14 @@ migrate_podkop_plus_config_if_needed() {
|
||||
|
||||
if is_original_podkop_present; then
|
||||
warn "Detected the original Podkop installation together with a shared legacy config at /etc/config/podkop."
|
||||
warn "Podkop Plus will not import this shared config automatically. The new version will use /etc/config/podkop_plus."
|
||||
warn "Podkop Plus will not import this shared config automatically. The new version will use /etc/config/podkop-plus."
|
||||
return 0
|
||||
fi
|
||||
|
||||
cp /etc/config/podkop /etc/config/podkop_plus || fail "Failed to migrate the Podkop Plus config to /etc/config/podkop_plus"
|
||||
chmod 0644 /etc/config/podkop_plus || true
|
||||
cp /etc/config/podkop /etc/config/podkop-plus || fail "Failed to migrate the Podkop Plus config to /etc/config/podkop-plus"
|
||||
chmod 0644 /etc/config/podkop-plus || true
|
||||
|
||||
msg "Migrated the Podkop Plus config to /etc/config/podkop_plus"
|
||||
msg "Migrated the Podkop Plus config to /etc/config/podkop-plus"
|
||||
}
|
||||
|
||||
reset_legacy_config_if_needed() {
|
||||
@@ -475,7 +483,7 @@ reset_legacy_config_if_needed() {
|
||||
default_config_url=""
|
||||
default_config_tmp=""
|
||||
|
||||
[ -f /etc/config/podkop_plus ] || return 0
|
||||
[ -f /etc/config/podkop-plus ] || return 0
|
||||
|
||||
current_version="$(detect_installed_podkop_plus_version)"
|
||||
|
||||
@@ -491,19 +499,19 @@ reset_legacy_config_if_needed() {
|
||||
fi
|
||||
|
||||
warn "Detected a legacy Podkop Plus installation."
|
||||
warn "The current config will be backed up to /etc/config/podkop_plus-070.<timestamp> and replaced with the Podkop Plus default config."
|
||||
warn "The current config will be backed up to /etc/config/podkop-plus-070.<timestamp> and replaced with the Podkop Plus default config."
|
||||
|
||||
confirm_prompt "Continue and reset /etc/config/podkop_plus?" || fail "Installation cancelled by user"
|
||||
confirm_prompt "Continue and reset /etc/config/podkop-plus?" || fail "Installation cancelled by user"
|
||||
|
||||
backup_path="/etc/config/podkop_plus-070.$(date +%Y%m%d%H%M%S 2>/dev/null || echo "$$")"
|
||||
mv /etc/config/podkop_plus "$backup_path" || fail "Failed to back up /etc/config/podkop_plus"
|
||||
backup_path="/etc/config/podkop-plus-070.$(date +%Y%m%d%H%M%S 2>/dev/null || echo "$$")"
|
||||
mv /etc/config/podkop-plus "$backup_path" || fail "Failed to back up /etc/config/podkop-plus"
|
||||
|
||||
default_config_url="https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_NAME}/${PODKOP_PLUS_RELEASE_TAG}/podkop/files/etc/config/podkop"
|
||||
default_config_tmp="$TMP_DIR/default-podkop-plus-config"
|
||||
|
||||
download_with_retry "$default_config_url" "$default_config_tmp" "default Podkop Plus config" || fail "Failed to download the default Podkop Plus config"
|
||||
cp "$default_config_tmp" /etc/config/podkop_plus || fail "Failed to restore /etc/config/podkop_plus"
|
||||
chmod 0644 /etc/config/podkop_plus || true
|
||||
cp "$default_config_tmp" /etc/config/podkop-plus || fail "Failed to restore /etc/config/podkop-plus"
|
||||
chmod 0644 /etc/config/podkop-plus || true
|
||||
|
||||
msg "A fresh Podkop Plus config was installed. Backup saved to $backup_path"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=luci-app-podkop-plus
|
||||
|
||||
PODKOP_BASE_VERSION:=$(or $(PODKOP_BASE_VERSION),$(PODKOP_VERSION),0.7.14)
|
||||
PODKOP_FORK_RELEASE:=$(or $(PODKOP_FORK_RELEASE),1)
|
||||
PODKOP_FORK_RELEASE:=$(or $(PODKOP_FORK_RELEASE),3)
|
||||
PODKOP_PACKAGE_VERSION:=$(PODKOP_BASE_VERSION)-$(PODKOP_FORK_RELEASE)
|
||||
|
||||
PKG_VERSION:=$(PODKOP_PACKAGE_VERSION)
|
||||
@@ -26,6 +26,19 @@ define Package/$(PKG_NAME)/description
|
||||
Rule-based Podkop Plus LuCI app with hybrid sing-box + zapret orchestration
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$${IPKG_INSTROOT}" ] && exit 0
|
||||
|
||||
if [ ! -f /etc/config/podkop-plus ] && [ -f /etc/config/podkop_plus ]; then
|
||||
cp /etc/config/podkop_plus /etc/config/podkop-plus || exit 1
|
||||
chmod 0644 /etc/config/podkop-plus 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
|
||||
@@ -37,7 +50,7 @@ exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/podkop_plus
|
||||
/etc/config/podkop-plus
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
@@ -48,7 +61,7 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ../podkop/files/etc/init.d/podkop $(1)/etc/init.d/podkop-plus
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ../podkop/files/etc/config/podkop $(1)/etc/config/podkop_plus
|
||||
$(INSTALL_CONF) ../podkop/files/etc/config/podkop $(1)/etc/config/podkop-plus
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) ../podkop/files/usr/bin/podkop $(1)/usr/bin/podkop-plus
|
||||
$(INSTALL_DIR) $(1)/usr/lib/podkop-plus
|
||||
|
||||
@@ -571,7 +571,7 @@ var STATUS_COLORS = {
|
||||
ERROR: "#f44336",
|
||||
WARNING: "#ff9800"
|
||||
};
|
||||
var PODKOP_UCI_PACKAGE = "podkop_plus";
|
||||
var PODKOP_UCI_PACKAGE = "podkop-plus";
|
||||
var PODKOP_LUCI_VIEW_NAMESPACE = "podkop_plus";
|
||||
var PODKOP_LUCI_VIEW_DIR = `/www/luci-static/resources/view/${PODKOP_LUCI_VIEW_NAMESPACE}`;
|
||||
var PODKOP_LUCI_I18N_DOMAIN = "podkop_plus";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-podkop-plus" ],
|
||||
"uci": { "podkop_plus": true }
|
||||
"uci": { "podkop-plus": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
]
|
||||
},
|
||||
"uci": [
|
||||
"podkop_plus"
|
||||
"podkop-plus"
|
||||
]
|
||||
},
|
||||
"write": {
|
||||
"uci": [
|
||||
"podkop_plus"
|
||||
"podkop-plus"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ USE_PROCD=1
|
||||
|
||||
script=$(readlink "$initscript")
|
||||
NAME="$(basename ${script:-$initscript})"
|
||||
CONFIG_NAME="podkop_plus"
|
||||
CONFIG_NAME="podkop-plus"
|
||||
PODKOP_BIN="/usr/bin/podkop-plus"
|
||||
PODKOP_SERVICE_INIT="/etc/init.d/podkop-plus"
|
||||
PODKOP_RELOAD_LOCK_DIR="/var/run/podkop-plus.reload.lock"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
PODKOP_APP_NAME="Podkop Plus"
|
||||
PODKOP_VERSION="__COMPILED_VERSION_VARIABLE__"
|
||||
PODKOP_CONFIG_NAME="podkop_plus"
|
||||
PODKOP_CONFIG_NAME="podkop-plus"
|
||||
PODKOP_CONFIG="/etc/config/$PODKOP_CONFIG_NAME"
|
||||
PODKOP_BIN="/usr/bin/podkop-plus"
|
||||
PODKOP_SERVICE_NAME="podkop-plus"
|
||||
@@ -12,6 +12,7 @@ PODKOP_RELEASE_REPO="ushan0v/podkop-plus"
|
||||
PODKOP_LUCI_VIEW_NAMESPACE="podkop_plus"
|
||||
PODKOP_LUCI_VIEW_DIR="/www/luci-static/resources/view/$PODKOP_LUCI_VIEW_NAMESPACE"
|
||||
PODKOP_LUCI_I18N_DOMAIN="podkop_plus"
|
||||
PODKOP_DNSMASQ_SECTION="podkop_plus"
|
||||
## Common
|
||||
RESOLV_CONF="/etc/resolv.conf"
|
||||
DNS_RESOLVERS="1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 9.9.9.9 9.9.9.11 94.140.14.14 94.140.15.15 208.67.220.220 208.67.222.222 77.88.8.1 77.88.8.8"
|
||||
|
||||
@@ -5,7 +5,7 @@ SCRIPT_PATH="$(readlink -f "${BASH_SOURCE[0]}")"
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
RELEASE_VERSION="${1:-0.7.14-1}"
|
||||
RELEASE_VERSION="${1:-0.7.14-3}"
|
||||
OUTPUT_DIR_INPUT="${2:-}"
|
||||
BASE_VERSION="${RELEASE_VERSION%-*}"
|
||||
FORK_RELEASE="${RELEASE_VERSION##*-}"
|
||||
@@ -239,7 +239,7 @@ build_app_root() {
|
||||
fi
|
||||
|
||||
install -m 0755 "$ROOT_DIR/podkop/files/etc/init.d/podkop" "$output_root/etc/init.d/podkop-plus"
|
||||
install -m 0644 "$ROOT_DIR/podkop/files/etc/config/podkop" "$output_root/etc/config/podkop_plus"
|
||||
install -m 0644 "$ROOT_DIR/podkop/files/etc/config/podkop" "$output_root/etc/config/podkop-plus"
|
||||
install -m 0755 "$ROOT_DIR/podkop/files/usr/bin/podkop" "$output_root/usr/bin/podkop-plus"
|
||||
cp -a "$ROOT_DIR/podkop/files/usr/lib/." "$output_root/usr/lib/podkop-plus/"
|
||||
|
||||
@@ -316,7 +316,19 @@ Description: ${APP_DESCRIPTION}
|
||||
EOF
|
||||
|
||||
cat > "$control_dir/conffiles" <<'EOF'
|
||||
/etc/config/podkop_plus
|
||||
/etc/config/podkop-plus
|
||||
EOF
|
||||
|
||||
cat > "$control_dir/preinst" <<'EOF'
|
||||
#!/bin/sh
|
||||
[ -n "${IPKG_INSTROOT}" ] && exit 0
|
||||
|
||||
if [ ! -f /etc/config/podkop-plus ] && [ -f /etc/config/podkop_plus ]; then
|
||||
cp /etc/config/podkop_plus /etc/config/podkop-plus || exit 1
|
||||
chmod 0644 /etc/config/podkop-plus 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
cat > "$control_dir/postinst" <<'EOF'
|
||||
@@ -352,7 +364,7 @@ grep -q "105 podkopplus" /etc/iproute2/rt_tables && sed -i "/105 podkopplus/d" /
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod 0755 "$control_dir/postinst" "$control_dir/prerm" "$control_dir/prerm-pkg"
|
||||
chmod 0755 "$control_dir/preinst" "$control_dir/postinst" "$control_dir/prerm" "$control_dir/prerm-pkg"
|
||||
}
|
||||
|
||||
write_i18n_ipk_control() {
|
||||
@@ -427,6 +439,18 @@ write_app_apk_scripts() {
|
||||
rm -rf "$scripts_dir"
|
||||
make_dir "$scripts_dir"
|
||||
|
||||
cat > "$scripts_dir/app-pre-install.sh" <<'EOF'
|
||||
#!/bin/sh
|
||||
[ -n "${IPKG_INSTROOT}" ] && exit 0
|
||||
|
||||
if [ ! -f /etc/config/podkop-plus ] && [ -f /etc/config/podkop_plus ]; then
|
||||
cp /etc/config/podkop_plus /etc/config/podkop-plus || exit 1
|
||||
chmod 0644 /etc/config/podkop-plus 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
cat > "$scripts_dir/app-post-install.sh" <<'EOF'
|
||||
#!/bin/sh
|
||||
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
|
||||
@@ -452,6 +476,18 @@ export pkgname="luci-app-podkop-plus"
|
||||
default_prerm
|
||||
grep -q "105 podkopplus" /etc/iproute2/rt_tables && sed -i "/105 podkopplus/d" /etc/iproute2/rt_tables
|
||||
/etc/init.d/podkop-plus stop >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
cat > "$scripts_dir/app-pre-upgrade.sh" <<'EOF'
|
||||
#!/bin/sh
|
||||
[ -n "${IPKG_INSTROOT}" ] && exit 0
|
||||
|
||||
if [ ! -f /etc/config/podkop-plus ] && [ -f /etc/config/podkop_plus ]; then
|
||||
cp /etc/config/podkop_plus /etc/config/podkop-plus || exit 1
|
||||
chmod 0644 /etc/config/podkop-plus 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
@@ -480,6 +516,11 @@ write_i18n_apk_scripts() {
|
||||
|
||||
make_dir "$scripts_dir"
|
||||
|
||||
cat > "$scripts_dir/i18n-pre-install.sh" <<'EOF'
|
||||
#!/bin/sh
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
cat > "$scripts_dir/i18n-post-install.sh" <<'EOF'
|
||||
#!/bin/sh
|
||||
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0
|
||||
@@ -498,6 +539,11 @@ EOF
|
||||
export root="${IPKG_INSTROOT}"
|
||||
export pkgname="luci-i18n-podkop-plus-ru"
|
||||
default_prerm
|
||||
EOF
|
||||
|
||||
cat > "$scripts_dir/i18n-pre-upgrade.sh" <<'EOF'
|
||||
#!/bin/sh
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
cat > "$scripts_dir/i18n-post-upgrade.sh" <<'EOF'
|
||||
@@ -548,8 +594,10 @@ build_apk_package() {
|
||||
-I "maintainer:${maintainer}" \
|
||||
-I "url:${PROJECT_URL}" \
|
||||
-I "depends:${depends}" \
|
||||
-s "pre-install:${temp_scripts}/${script_prefix}-pre-install.sh" \
|
||||
-s "post-install:${temp_scripts}/${script_prefix}-post-install.sh" \
|
||||
-s "pre-deinstall:${temp_scripts}/${script_prefix}-pre-deinstall.sh" \
|
||||
-s "pre-upgrade:${temp_scripts}/${script_prefix}-pre-upgrade.sh" \
|
||||
-s "post-upgrade:${temp_scripts}/${script_prefix}-post-upgrade.sh"
|
||||
elif have_passwordless_sudo; then
|
||||
sudo chown -R 0:0 "$temp_root" "$temp_scripts"
|
||||
@@ -565,8 +613,10 @@ build_apk_package() {
|
||||
-I "maintainer:${maintainer}" \
|
||||
-I "url:${PROJECT_URL}" \
|
||||
-I "depends:${depends}" \
|
||||
-s "pre-install:${temp_scripts}/${script_prefix}-pre-install.sh" \
|
||||
-s "post-install:${temp_scripts}/${script_prefix}-post-install.sh" \
|
||||
-s "pre-deinstall:${temp_scripts}/${script_prefix}-pre-deinstall.sh" \
|
||||
-s "pre-upgrade:${temp_scripts}/${script_prefix}-pre-upgrade.sh" \
|
||||
-s "post-upgrade:${temp_scripts}/${script_prefix}-post-upgrade.sh"
|
||||
sudo chown "$(id -u):$(id -g)" "$output_file"
|
||||
sudo rm -rf "$temp_root" "$temp_scripts"
|
||||
@@ -586,8 +636,10 @@ build_apk_package() {
|
||||
-I 'maintainer:${maintainer}' \
|
||||
-I 'url:${PROJECT_URL}' \
|
||||
-I 'depends:${depends}' \
|
||||
-s pre-install:'$temp_scripts/${script_prefix}-pre-install.sh' \
|
||||
-s post-install:'$temp_scripts/${script_prefix}-post-install.sh' \
|
||||
-s pre-deinstall:'$temp_scripts/${script_prefix}-pre-deinstall.sh' \
|
||||
-s pre-upgrade:'$temp_scripts/${script_prefix}-pre-upgrade.sh' \
|
||||
-s post-upgrade:'$temp_scripts/${script_prefix}-post-upgrade.sh'
|
||||
" 2>"$stderr_file"; then
|
||||
grep -v "object 'libfakeroot-.*so' from LD_PRELOAD cannot be preloaded" "$stderr_file" >&2 || true
|
||||
@@ -733,7 +785,7 @@ main() {
|
||||
"$i18n_control" \
|
||||
"$output_dir/luci-i18n-podkop-plus-ru_${RELEASE_VERSION}.ipk"
|
||||
|
||||
generate_apk_metadata_files "luci-app-podkop-plus" "$app_root" "/etc/config/podkop_plus"
|
||||
generate_apk_metadata_files "luci-app-podkop-plus" "$app_root" "/etc/config/podkop-plus"
|
||||
generate_apk_metadata_files "luci-i18n-podkop-plus-ru" "$i18n_root"
|
||||
write_app_apk_scripts "$apk_scripts"
|
||||
write_i18n_apk_scripts "$apk_scripts"
|
||||
|
||||
@@ -632,14 +632,17 @@ is_original_podkop_present() {
|
||||
[ -f /usr/share/rpcd/acl.d/luci-app-podkop.json ]
|
||||
}
|
||||
|
||||
if [ ! -f /etc/config/podkop_plus ]; then
|
||||
if [ -f /etc/config/podkop ] &&
|
||||
if [ ! -f /etc/config/podkop-plus ]; then
|
||||
if [ -f /etc/config/podkop_plus ]; then
|
||||
cp /etc/config/podkop_plus /etc/config/podkop-plus
|
||||
chmod 0644 /etc/config/podkop-plus || true
|
||||
elif [ -f /etc/config/podkop ] &&
|
||||
{ [ -x /etc/init.d/podkop-plus ] || [ -x /usr/bin/podkop-plus ] || [ -d /usr/lib/podkop-plus ]; } &&
|
||||
! is_original_podkop_present; then
|
||||
cp /etc/config/podkop /etc/config/podkop_plus
|
||||
chmod 0644 /etc/config/podkop_plus || true
|
||||
cp /etc/config/podkop /etc/config/podkop-plus
|
||||
chmod 0644 /etc/config/podkop-plus || true
|
||||
else
|
||||
replace_file "$BUNDLE_DIR/etc/config/podkop_plus" "/etc/config/podkop_plus" 0644
|
||||
replace_file "$BUNDLE_DIR/etc/config/podkop-plus" "/etc/config/podkop-plus" 0644
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -699,7 +702,7 @@ function New-DeployBundle {
|
||||
|
||||
$bundleFiles = @{
|
||||
'podkop/files/etc/init.d/podkop' = 'etc/init.d/podkop-plus'
|
||||
'podkop/files/etc/config/podkop' = 'etc/config/podkop_plus'
|
||||
'podkop/files/etc/config/podkop' = 'etc/config/podkop-plus'
|
||||
'podkop/files/usr/bin/podkop' = 'usr/bin/podkop-plus'
|
||||
'luci-app-podkop-plus/root/usr/share/luci/menu.d/luci-app-podkop-plus.json' = 'usr/share/luci/menu.d/luci-app-podkop-plus.json'
|
||||
'luci-app-podkop-plus/root/usr/share/rpcd/acl.d/luci-app-podkop-plus.json' = 'usr/share/rpcd/acl.d/luci-app-podkop-plus.json'
|
||||
|
||||
Reference in New Issue
Block a user