diff --git a/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/tachyon.js b/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/tachyon.js index 4e8bd25f..802d8875 100644 --- a/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/tachyon.js +++ b/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/tachyon.js @@ -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; }) diff --git a/tachyon/files/usr/lib/service/package.uc b/tachyon/files/usr/lib/service/package.uc index 50dc5594..f397773b 100644 --- a/tachyon/files/usr/lib/service/package.uc +++ b/tachyon/files/usr/lib/service/package.uc @@ -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" ]); diff --git a/tachyon/files/usr/lib/service/uninstall.uc b/tachyon/files/usr/lib/service/uninstall.uc index faeaf17a..36b39433 100644 --- a/tachyon/files/usr/lib/service/uninstall.uc +++ b/tachyon/files/usr/lib/service/uninstall.uc @@ -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) diff --git a/uninstall.sh b/uninstall.sh index d43ffd07..c1347045 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -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