mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 11:36:50 +03:00
refactor: use uci wrappers
This commit is contained in:
@@ -126,7 +126,7 @@ start() {
|
|||||||
# base
|
# base
|
||||||
route_table_rule_mark
|
route_table_rule_mark
|
||||||
create_nft_rules
|
create_nft_rules
|
||||||
sing_box_uci
|
sing_box_configure_service
|
||||||
|
|
||||||
# sing-box
|
# sing-box
|
||||||
sing_box_init_config
|
sing_box_init_config
|
||||||
@@ -526,29 +526,30 @@ list_update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# sing-box funcs
|
# sing-box funcs
|
||||||
sing_box_uci() {
|
sing_box_configure_service() {
|
||||||
local sing_box_enabled sing_box_user sing_box_config_path sing_box_conffile
|
local sing_box_enabled sing_box_user sing_box_config_path sing_box_conffile
|
||||||
sing_box_enabled=$(uci get "sing-box.main.enabled")
|
sing_box_enabled="$(uci_get "sing-box" "main" "enabled")"
|
||||||
sing_box_user=$(uci get "sing-box.main.user")
|
sing_box_user="$(uci_get "sing-box" "main" "user")"
|
||||||
|
|
||||||
if [ "$sing_box_enabled" -ne 1 ]; then
|
if [ "$sing_box_enabled" -ne 1 ]; then
|
||||||
uci set "sing-box.main.enabled=1"
|
uci_set "sing-box" "main" "enabled" 1
|
||||||
uci commit "sing-box"
|
uci_commit "sing-box"
|
||||||
log "sing-box service has been enabled"
|
log "sing-box service has been enabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$sing_box_user" != "root" ]; then
|
if [ "$sing_box_user" != "root" ]; then
|
||||||
uci set "sing-box.main.user=root"
|
uci_set "sing-box" "main" "user" "root"
|
||||||
uci commit "sing-box"
|
uci_commit "sing-box"
|
||||||
log "sing-box service user has been changed to root"
|
log "sing-box service user has been changed to root"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_get sing_box_config_path "settings" "config_path"
|
config_get sing_box_config_path "settings" "config_path"
|
||||||
sing_box_conffile=$(uci get "sing-box.main.conffile")
|
sing_box_conffile="$(uci_get "sing-box" "main" "conffile")"
|
||||||
log "sing-box config path: $sing_box_config_path" "debug"
|
log "sing-box config path: $sing_box_config_path" "debug"
|
||||||
log "sing-box service conffile: $sing_box_conffile" "debug"
|
log "sing-box service conffile: $sing_box_conffile" "debug"
|
||||||
if [ "$sing_box_conffile" != "$sing_box_config_path" ]; then
|
if [ "$sing_box_conffile" != "$sing_box_config_path" ]; then
|
||||||
uci set "sing-box.main.conffile=$sing_box_config_path"
|
uci_set "sing-box" "main" "conffile" "$sing_box_config_path"
|
||||||
uci commit "sing-box"
|
uci_commit "sing-box"
|
||||||
log "Configuration file path has been set to $sing_box_config_path"
|
log "Configuration file path has been set to $sing_box_config_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user