Wipe current contents when reinstalling.
This commit is contained in:
parent
f91269ecc5
commit
957f6c7d46
29
reinstall.ks
29
reinstall.ks
|
@ -1,6 +1,31 @@
|
||||||
parameter BOOT_FILE is "rocket".
|
parameter BOOT_FILE is "rocket".
|
||||||
|
|
||||||
clearguis().
|
|
||||||
copypath("0:/boot/"+BOOT_FILE+".ks", "1:/boot/"+BOOT_FILE+".ks").
|
|
||||||
switch to 1.
|
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").
|
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("..").
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user