From a4cbaf398d860bc1180c22769127a4015523b44e Mon Sep 17 00:00:00 2001 From: Axel173 Date: Sat, 8 Aug 2026 02:48:46 +0400 Subject: [PATCH] install_lang: Tell the user how to reinstall the full patch The mark is written on every boot, not only right after an install, so once the full patch is in place the previous message was misleading: rebooting and running again hits the same refusal, because the boot re-applies the patch and re-creates the mark. Look at the patch script as well and give the advice that actually works - uninstall, reboot, install - and keep the plain "reboot first" message for the case where the mirror is still patched but the install is already gone. --- install_lang.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/install_lang.py b/install_lang.py index 4dce273..04d2102 100644 --- a/install_lang.py +++ b/install_lang.py @@ -189,15 +189,23 @@ if action == 'install': # Measured on a BE7000 (fw 1.1.38): 40400 bytes of sed rules on a clean run # against 3638 bytes on a rerun, with setting/wifi.htm losing 15 of its 198 # wrapped literals and setting/wan.htm 6 of 189. - fn = 'tmp/lang_www_patched' - if os.path.exists(fn): - os.remove(fn) - try: - gw.download('/tmp/lang_www_patched', fn, verbose = 0) - except ssh2.exceptions.SCPProtocolError: - pass - if os.path.exists(fn): - die("The web templates are already patched. Reboot the device, then run this again.") + def remote_exists(fn_remote, fn_local): + if os.path.exists(fn_local): + os.remove(fn_local) + try: + gw.download(fn_remote, fn_local, verbose = 0) + except ssh2.exceptions.SCPProtocolError: + pass + return os.path.exists(fn_local) + # The mark is written on every boot, so its presence alone does not tell + # whether the patch is currently installed. Look at the patch script too and + # give the advice that actually helps. + if remote_exists('/tmp/lang_www_patched', 'tmp/lang_www_patched'): + if remote_exists('/etc/crontabs/patches/lang_patch_www.sh', 'tmp/lang_patch_www_installed.sh'): + die("Full lang patch is already installed. To reinstall it, run " + "'install_lang.py uninstall', reboot the device, then install again.") + die("The web templates are still patched from an earlier install. " + "Reboot the device, then run this again.") #if patch_installed: # print("Uninstall lang_patch...") # gw.run_cmd(f"chmod +x {fn_remote_u} ; {fn_remote_u}")