Refactor bootstrapping sequence for a consistent experience.
This commit is contained in:
parent
826df45ff2
commit
f2f81cd838
|
@ -1,9 +1,11 @@
|
|||
deletepath("/boot/helicopter").
|
||||
runoncepath("0:/lib/boot").
|
||||
|
||||
compile "0:/lib/stabilize_helicopter" to "1:/lib/stabilize_helicopter".
|
||||
compile "0:/init/helicopter" to "1:/init".
|
||||
parameter debug is false.
|
||||
|
||||
// Set OS to boot and restart.
|
||||
set core:bootfilename to "/init".
|
||||
|
||||
reboot.
|
||||
Bootstrap(
|
||||
"/boot/helicopter",
|
||||
"/init/helicopter",
|
||||
list("/lib/stabilize_helicopter"),
|
||||
list("/lib/ui"),
|
||||
debug
|
||||
).
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
copypath("0:/lib/stabilize_helicopter", "1:/lib/stabilize_helicopter").
|
||||
copypath("0:/init/helicopter", "1:/init").
|
||||
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
run "1:/init".
|
||||
runpath("0:/boot/rocket", true).
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
// rocketOS bootstrapping sequence
|
||||
runoncepath("0:/lib/boot").
|
||||
|
||||
// To maximize space, remove this file first thing. The in-memory copy
|
||||
// will still run to completion, and it should only run once per vessel.
|
||||
deletepath("/boot/rocket").
|
||||
parameter debug is false.
|
||||
|
||||
// Install software.
|
||||
copypath("0:/lib/ui", "1:/lib/ui").
|
||||
compile "0:/lib/navigation" to "1:/lib/navigation".
|
||||
compile "0:/lib/throttle" to "1:/lib/throttle".
|
||||
compile "0:/lib/stabilize_rocket" to "1:/lib/stabilize_rocket".
|
||||
compile "0:/lib/node" to "1:/lib/node".
|
||||
compile "0:/init/rocket" to "1:/init".
|
||||
compile "0:/rocket/launch" to "1:/launch".
|
||||
local compiled is list(
|
||||
"/lib/navigation",
|
||||
"/lib/throttle",
|
||||
"/lib/stabilize_rocket",
|
||||
"/lib/node"
|
||||
).
|
||||
|
||||
// Set OS to boot and restart.
|
||||
set core:bootfilename to "/init".
|
||||
local copied is list(
|
||||
"/lib/ui"
|
||||
).
|
||||
|
||||
reboot.
|
||||
Bootstrap(
|
||||
"/boot/rocket",
|
||||
"/init/rocket",
|
||||
compiled,
|
||||
copied,
|
||||
debug
|
||||
).
|
||||
|
|
|
@ -1,11 +1,2 @@
|
|||
// Install software.
|
||||
copypath("0:/lib/navigation", "1:/lib/navigation").
|
||||
copypath("0:/lib/throttle", "1:/lib/throttle").
|
||||
copypath("0:/lib/node", "1:/lib/node").
|
||||
copypath("0:/lib/ui", "1:/lib/ui").
|
||||
copypath("0:/lib/stabilize_rocket", "1:/lib/stabilize_rocket").
|
||||
copypath("0:/init/rocket", "1:/init").
|
||||
copypath("0:/rocket/launch", "1:/launch").
|
||||
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
run "1:/init".
|
||||
runpath("0:/boot/rocket", true).
|
||||
|
|
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".
|
||||
}
|
Loading…
Reference in New Issue
Block a user