op-packages/luci-app-fchomo/root/etc/uci-defaults/99_luci-app-fchomo-migration_inbound
github-actions[bot] 09a1b41f45 🎉 Sync 2026-07-14 20:29:41
2026-07-14 20:29:41 +08:00

42 lines
858 B
Bash
Executable File

#!/bin/sh
# Migration script for fchomo inbound
# Used to migrate LuCI application inbound option.
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
CONF=fchomo
config_load "$CONF"
# isDefined <section> <option>
isDefined() {
local opt=CONFIG_${1}_${2};
eval "[ -n \"\${$opt+x}\" ] && return 0 || return 1"
}
migrate() {
# tuic_max_idle_time -> max_idle_time
if isDefined "$1" tuic_max_idle_time; then
local tuic_max_idle_time
config_get tuic_max_idle_time "$1" tuic_max_idle_time ""
uci_remove "$CONF" "$1" tuic_max_idle_time
uci_set "$CONF" "$1" max_idle_time "$tuic_max_idle_time"
fi
# plugin -> plugin_type
if isDefined "$1" plugin; then
local plugin
config_get plugin "$1" plugin ""
uci_set "$CONF" "$1" plugin "1"
uci_set "$CONF" "$1" plugin_type "$plugin"
fi
}
config_foreach migrate inbound
uci_commit "$CONF"
exit 0