Restore dnsmasq after legacy backend failure

This commit is contained in:
ushan0v
2026-07-14 22:34:57 +03:00
parent 01d98a9a47
commit 28ca142662
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -976,6 +976,8 @@ function select_dns_owner(legacy) {
}
}
let dnsmasq_failsafe_restore;
function installer_restore_dnsmasq(bin_path, legacy) {
if (path_executable(bin_path) && run_args([ bin_path, "restore_dnsmasq" ]))
return true;
@@ -1330,7 +1332,7 @@ function dnsmasq_restore_default_instance() {
}
}
function dnsmasq_failsafe_restore() {
dnsmasq_failsafe_restore = function() {
if (!uci_available())
return true;
@@ -1345,7 +1347,7 @@ function dnsmasq_failsafe_restore() {
uci_commit("dhcp");
restart_dnsmasq();
return true;
}
};
function release_version_valid(value) {
return match(as_string(value), /^[0-9]+[.][0-9]+[.][0-9]+$/) != null;
+2
View File
@@ -371,6 +371,7 @@ cat >"$WORK_DIR/legacy-bin" <<'SH'
printf '%s\n' "$*" >> "$FORKOP_INSTALLER_BIN_LOG"
case "$1" in
get_status) printf '%s\n' '{"running":1}' ;;
restore_dnsmasq) exit "${FORKOP_INSTALLER_FAIL_BACKEND_RESTORE:-0}" ;;
esac
exit 0
SH
@@ -402,6 +403,7 @@ FORKOP_INSTALLER_FAKE_LEGACY_BACKEND="$LEGACY_BACKEND" \
FORKOP_INSTALLER_OPKG_LOG="$WORK_DIR/opkg.log" \
FORKOP_INSTALLER_INIT_LOG="$WORK_DIR/init.log" \
FORKOP_INSTALLER_BIN_LOG="$WORK_DIR/bin.log" \
FORKOP_INSTALLER_FAIL_BACKEND_RESTORE=1 \
FORKOP_UCI_STATE_FILE="$WORK_DIR/empty-uci.state" \
ucode "$helper" installer-cleanup-legacy >"$state"