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(".."). + } +}