hopefully support OpenOS too
This commit is contained in:
parent
5dc27fd38b
commit
36c6859abf
@ -1,8 +1,10 @@
|
|||||||
local serial = require "serialization"
|
local serial = require "serialization"
|
||||||
|
local fs = fs or require "filesystem"
|
||||||
local component = require "component"
|
local component = require "component"
|
||||||
local computer = require "computer"
|
local computer = require "computer"
|
||||||
local diskpart = require "diskpart"
|
local diskpart = require "diskpart"
|
||||||
|
|
||||||
|
local cfgpath = (_OSVERSION or ""):sub(1,7) == "PsychOS" and "/boot/cfg/boop.cfg" or "/etc/boop.cfg"
|
||||||
local defaults = {
|
local defaults = {
|
||||||
path = "/boot/init.lua",
|
path = "/boot/init.lua",
|
||||||
drive = computer.getBootAddress():match("^([^/])")
|
drive = computer.getBootAddress():match("^([^/])")
|
||||||
@ -11,7 +13,7 @@ local defaults = {
|
|||||||
local tA = {...}
|
local tA = {...}
|
||||||
local config = defaults
|
local config = defaults
|
||||||
|
|
||||||
local f = io.open("/boot/cfg/boop.cfg","rb")
|
local f = io.open(cfgpath,"rb")
|
||||||
if f then
|
if f then
|
||||||
config = setmetatable(serial.unserialize(f:read("*a")), {__index=defaults})
|
config = setmetatable(serial.unserialize(f:read("*a")), {__index=defaults})
|
||||||
f:close()
|
f:close()
|
||||||
@ -47,6 +49,6 @@ end
|
|||||||
f:close()
|
f:close()
|
||||||
print("\nDone! Saving config...")
|
print("\nDone! Saving config...")
|
||||||
|
|
||||||
local f = io.open("/boot/cfg/boop.cfg", "wb")
|
local f = io.open(cfgpath, "wb")
|
||||||
f:write(serial.serialize(config))
|
f:write(serial.serialize(config))
|
||||||
f:close()
|
f:close()
|
||||||
|
Loading…
Reference in New Issue
Block a user