kOS/reinstall.ks

32 lines
537 B
Plaintext

parameter BOOT_FILE is "rocket".
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("..").
}
}