Refactor bootstrapping sequence for a consistent experience.
This commit is contained in:
47
lib/boot.ks
Normal file
47
lib/boot.ks
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
function Bootstrap {
|
||||
parameter bootfile, init, compiled, copied, debug.
|
||||
compileInit(init, debug).
|
||||
compileLibs(compiled, debug).
|
||||
copyLibs(copied).
|
||||
|
||||
if debug {
|
||||
// Open a terminal and run init.
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
run "/init".
|
||||
} else {
|
||||
DeletePath("1:" + bootfile).
|
||||
// Set OS to boot and restart.
|
||||
set core:bootfilename to "/init".
|
||||
reboot.
|
||||
}
|
||||
}
|
||||
|
||||
function compileLibs {
|
||||
parameter libs, debug.
|
||||
if debug {
|
||||
CopyLibs(libs).
|
||||
return.
|
||||
}
|
||||
|
||||
for lib in libs {
|
||||
compile "0:" + lib to "1:" + lib.
|
||||
}
|
||||
}
|
||||
|
||||
function copyLibs {
|
||||
parameter libs.
|
||||
for lib in libs {
|
||||
copypath("0:" + lib, "1:" + lib).
|
||||
}
|
||||
}
|
||||
|
||||
function copyInit {
|
||||
parameter init, debug is false.
|
||||
if debug {
|
||||
copypath("0:" + init, "1:/init").
|
||||
return.
|
||||
}
|
||||
|
||||
compile "0:" + init to "1:/init".
|
||||
}
|
Reference in New Issue
Block a user