fix(luci): ensure ucitrack registration and trigger service reload on save and apply

This commit is contained in:
Dushnilin
2026-09-09 20:28:56 +03:00
parent f2865b4bb2
commit c2908d484a
4 changed files with 46 additions and 1 deletions
@@ -463,7 +463,15 @@ const EntryPoint = {
return Promise.resolve(originalHandleSaveApply.call(this, ev, mode))
.then((result) => {
window.setTimeout(refreshUiState, 250);
if (
main.TachyonShellMethods &&
typeof main.TachyonShellMethods.serviceActionStart === "function"
) {
main.TachyonShellMethods.serviceActionStart("reload").catch(
() => null,
);
}
window.setTimeout(refreshUiState, 500);
return result;
})
+28
View File
@@ -309,11 +309,39 @@ function ensure_guest_mode_section() {
}
}
const UCITRACK_FILE = env("TACHYON_UCITRACK_FILE", "/etc/config/ucitrack");
function ensure_ucitrack_entry() {
if (!path_exists(UCITRACK_FILE))
return false;
let cursor = uci_core.cursor();
if (!cursor)
return false;
let has_entry = false;
cursor.load("ucitrack");
cursor.foreach("ucitrack", "tachyon", function(s) {
has_entry = true;
return false;
});
if (!has_entry) {
let sid = cursor.add("ucitrack", "tachyon");
if (sid) {
cursor.set("ucitrack", sid, "init", "tachyon");
cursor.commit("ucitrack");
}
}
return true;
}
function luci_postinst() {
remove_luci_index_cache();
remove_component_update_cache();
if (!PACKAGE_TEST_MODE) {
ensure_guest_mode_section();
ensure_ucitrack_entry();
if (path_exists("/etc/init.d/rpcd"))
command_success_from_args([ "/etc/init.d/rpcd", "reload" ]);
command_success_from_args([ "logger", "-t", "tachyon", "[info] Package defaults applied" ]);
@@ -243,6 +243,9 @@ function uninstall_tachyon(purge_config, keep_binaries) {
// Clear LuCI cache and restart rpcd/uhttpd
run_shell("rm -f /var/luci-indexcache* /tmp/luci-indexcache* /tmp/luci-modulecache/* 2>/dev/null || true");
if (fs.stat("/etc/config/ucitrack") != null) {
run_shell("uci -q delete ucitrack.@tachyon[0] >/dev/null 2>&1; uci -q commit ucitrack >/dev/null 2>&1 || true");
}
if (fs.stat("/etc/init.d/rpcd") != null)
run_cmd(["/etc/init.d/rpcd", "restart"]);
if (fs.stat("/etc/init.d/uhttpd") != null)
+6
View File
@@ -403,6 +403,12 @@ rm -rf /var/run/tachyon* /var/log/tachyon* /tmp/sing-box /tmp/tachyon* /tmp/ai_d
# Clear LuCI index and module caches
rm -f /var/luci-indexcache* /tmp/luci-indexcache* /tmp/luci-modulecache/* 2>/dev/null || true
# Clean ucitrack entry
if [ -f "/etc/config/ucitrack" ]; then
uci -q delete ucitrack.@tachyon[0] 2>/dev/null || true
uci -q commit ucitrack 2>/dev/null || true
fi
# Purge configs and persistent state if requested
if [ "$OPT_PURGE" -eq 1 ]; then
rm -f /etc/config/tachyon* 2>/dev/null || true