From aa0837ec492fc2da908b1832b214353ab30bbadb Mon Sep 17 00:00:00 2001 From: KOWX712 Date: Wed, 15 Jan 2025 22:11:23 +0800 Subject: [PATCH] backup before putting a new kb #8 --- module/webui/scripts/menu_option.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/webui/scripts/menu_option.js b/module/webui/scripts/menu_option.js index b6cdcc0..1d79e8b 100644 --- a/module/webui/scripts/menu_option.js +++ b/module/webui/scripts/menu_option.js @@ -76,7 +76,7 @@ export async function aospkb() { try { const sourcePath = `${basePath}common/.default`; const destinationPath = "/data/adb/tricky_store/keybox.xml"; - await execCommand(`xxd -r -p ${sourcePath} | base64 -d > ${destinationPath}`); + await execCommand(`mv -f ${destinationPath} ${destinationPath}.bak && xxd -r -p ${sourcePath} | base64 -d > ${destinationPath}`); console.log("AOSP keybox copied successfully."); showPrompt("prompt.aosp_key_set"); } catch (error) { @@ -98,7 +98,7 @@ document.getElementById("extrakb").addEventListener("click", async () => { if (fileExists.trim() !== "exists") { throw new Error(".extra file not found"); } - await execCommand(`xxd -r -p ${sourcePath} | base64 -d > ${destinationPath}`); + await execCommand(`mv -f ${destinationPath} ${destinationPath}.bak && xxd -r -p ${sourcePath} | base64 -d > ${destinationPath}`); console.log("Valid keybox copied successfully."); showPrompt("prompt.valid_key_set"); } catch (error) {