From 957f6c7d46802460e0d00dad5e7ae16510d7666d Mon Sep 17 00:00:00 2001 From: annabunches Date: Sun, 22 Aug 2021 22:25:41 -0400 Subject: [PATCH] Wipe current contents when reinstalling. --- reinstall.ks | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/reinstall.ks b/reinstall.ks index 6ffa89e..3bb9c4e 100644 --- a/reinstall.ks +++ b/reinstall.ks @@ -1,6 +1,31 @@ parameter BOOT_FILE is "rocket". -clearguis(). -copypath("0:/boot/"+BOOT_FILE+".ks", "1:/boot/"+BOOT_FILE+".ks"). switch to 1. +clearguis(). + +// delete files on current volume +wipeDir("1:/", true). + +// copy the new bootloader and execute it. +copypath("0:/boot/"+BOOT_FILE+".ks", "1:/boot/"+BOOT_FILE+".ks"). runpath("/boot/"+BOOT_FILE+".ks"). + +function wipeDir { + parameter dir, root is false. + + cd(dir). + + local fileList is list(). + list files in fileList. + for f in fileList { + if f:ISFILE { + deletepath(f). + } else if f:NAME[0] <> "." { + wipeDir(f). + } + } + + if not root { + cd(".."). + } +}