Moved CapyOS to folder /sys

This commit is contained in:
Alessandro Proto 2023-04-11 13:24:11 +02:00
parent 756b8b35dd
commit b09ab4bdff
33 changed files with 20 additions and 13 deletions

View file

@ -1,3 +0,0 @@
package.path = "/lib/?.lua;/lib/?/init.lua;" .. package.path
_G.io = require("io")

View file

@ -1,10 +1,11 @@
local version = "0.0.2"
local version = "0.0.3"
local systemDirectory = "/sys"
print("Starting CapyOS")
local term = require("term")
local fs = require("fs")
local gpu = require("gpu")
local machine = require("machine")
local nPrint = print
local function showError(err)
@ -26,11 +27,12 @@ function os.version()
end
term.setPos(1, 1)
term.write(_HOST)
term.write(machine.version())
term.setPos(1, 3)
local files = fs.list("/boot/autorun")
local files = fs.list(fs.combine(systemDirectory, "boot/autorun"))
for i = 1, #files do
local func, err = loadfile("/boot/autorun/" .. files[i])
local func, err = loadfile(fs.combine(systemDirectory, "boot/autorun", files[i]))
if not func then
showError(err)
break

View file

@ -6,7 +6,7 @@ local machine = require("machine")
local exit = false
local shell = {}
shell.path = "./?;./?.lua;/bin/?.lua"
shell.path = "./?;./?.lua;/bin/?.lua;/sys/bin/?.lua"
shell.homePath = "/home"
local currentDir = shell.homePath

View file

@ -0,0 +1,3 @@
package.path = "/lib/?.lua;/lib/?/init.lua;/sys/lib/?.lua;/sys/lib/?/init.lua;" .. package.path
_G.io = require("io")

View file

@ -10,6 +10,6 @@ term.setPos(1, 1)
term.write(os.version())
term.setPos(1, 2)
dofile("/bin/shell.lua")
dofile("/sys/bin/shell.lua")
machine.shutdown()

View file

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -51,13 +51,13 @@ local function writeCenter(text)
end
local function drawVendorImage()
if not fs.exists("/boot/vendor.bmp") then
if not fs.exists("/sys/vendor.bmp") then
return
end
local w, h = gpu.getSize()
local ok, err = pcall(function()
local task<close> = gpu.loadImageAsync("/boot/vendor.bmp")
local task<close> = gpu.loadImageAsync("/sys/vendor.bmp")
local buffer<close> = task:await()
local x, y =
@ -95,6 +95,11 @@ local function promptKey()
event.pull("key_down")
end
local function installDefaultOS()
fs.delete("/sys", true)
installOS()
end
term.setBlink(false)
local function setupScreen()
@ -105,7 +110,7 @@ local function setupScreen()
},
{
"Install default OS",
installOS,
installDefaultOS,
},
{
"Exit setup",