2021-08-02 04:06:43 +00:00
|
|
|
|
|
|
|
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").
|
2021-08-04 22:41:13 +00:00
|
|
|
if init <> "" {
|
|
|
|
run "/init".
|
|
|
|
}
|
2021-08-02 04:06:43 +00:00
|
|
|
} else {
|
|
|
|
DeletePath("1:" + bootfile).
|
|
|
|
// Set OS to boot and restart.
|
2021-08-04 22:41:13 +00:00
|
|
|
if init = "" {
|
|
|
|
set CORE:BOOTFILENAME to init.
|
|
|
|
} else {
|
|
|
|
set CORE:BOOTFILENAME to "/init".
|
|
|
|
}
|
2021-08-02 04:06:43 +00:00
|
|
|
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).
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-02 04:12:11 +00:00
|
|
|
function compileInit {
|
2021-08-02 04:06:43 +00:00
|
|
|
parameter init, debug is false.
|
2021-08-04 22:41:13 +00:00
|
|
|
|
|
|
|
if init = "" {
|
|
|
|
return.
|
|
|
|
}
|
|
|
|
|
2021-08-02 04:06:43 +00:00
|
|
|
if debug {
|
|
|
|
copypath("0:" + init, "1:/init").
|
|
|
|
return.
|
|
|
|
}
|
|
|
|
|
|
|
|
compile "0:" + init to "1:/init".
|
|
|
|
}
|