56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
@LAZYGLOBAL OFF.
|
|
|
|
clearscreen.
|
|
clearguis().
|
|
clearvecdraws().
|
|
|
|
set TERMINAL:width to 50.
|
|
set TERMINAL:height to 30.
|
|
CORE:doaction("Open Terminal", true).
|
|
|
|
print "=================== BOOTING ===================".
|
|
wait until SHIP:loaded and SHIP:unpacked.
|
|
wait 0.001.
|
|
|
|
if HOMECONNECTION:isconnected {
|
|
update_scripts().
|
|
} else {
|
|
print "No connection to KSC: not updating scripts.".
|
|
}
|
|
|
|
print "============= BOOT SEQUENCE COMPLETE =============".
|
|
|
|
|
|
function update_scripts {
|
|
//
|
|
// Copy all .ks-files from the archive to the CPU's internal storage.
|
|
//
|
|
|
|
// Get lexicon of existing items (files/directories) and sizes on the internal storage
|
|
local existing is LEXICON().
|
|
for item in CORE:volume:files:values {
|
|
set existing[item:name] to item:size.
|
|
}
|
|
|
|
for item in volume("ARCHIVE"):files:values {
|
|
copy_file_if_necessary(item).
|
|
}
|
|
}
|
|
|
|
function copy_file_if_necessary {
|
|
parameter file.
|
|
|
|
if item:name[0] = "." // skip linux hidden dirs (e.g. .git)
|
|
return.
|
|
if item:isfile and item:extension <> "ks" // skip non-script items (e.g. README.md)
|
|
return.
|
|
if existing:haskey(item:name) and item:size = existing[item:name] // skip if local item is same size
|
|
return.
|
|
|
|
print "Copying " + item:name.
|
|
copypath(path(volume("ARCHIVE")):combine(item:name), CORE:volume).
|
|
|
|
if item:name = "boot"
|
|
reboot. // reboot CPU if boot/ directory was updated
|
|
}
|