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