Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SEPERATOR = "======================================="
- local UTILSPASTE = "JiLvEML4"
- local OSDIR = [[OS/]]
- local PROGDIR = [[OS/PROG/]]
- local STARTUP = 'shell.run("clear"); shell.run("OS/os.lua")'
- local osActive = true
- --// Get utils module
- if fs.exists("startup.lua") then shell.run("delete startup.lua"); end
- --shell.run("pastebin get "..UTILSPASTE.." "..OSDIR.."os_utils.lua") -- grab os utils
- --local Utils = require(OSDIR.."os_utils.lua")
- local options_main = {
- {label="Installer",file="Era6PJf4"},
- {label="Shell",file=""},
- {label="Fuel",file="LKm6jXGQ"},
- }
- local optInd = 1
- fs.makeDir(PROGDIR)
- local options_progs = {}
- function Setup()
- end
- function Start()
- makeStartup(STARTUP)
- shell.run()
- end
- function Main()
- Start()
- optInd = 1
- shell.run("clear")
- print(SEPERATOR)
- print("Frogpulp OS - Turtle Edition")
- print(SEPERATOR)
- for i,opt in ipairs(options_main) do
- print(optInd..". "..opt.label)
- optInd = optInd + 1
- end
- for i,file in ipairs(fs.list(PROGDIR)) do
- table.insert(options_progs,i,string.gsub(file,PROGDIR,""))
- end
- print(SEPERATOR)
- for i,v in pairs(options_progs) do
- print(optInd..". "..v)
- optInd = optInd + 1
- end
- if #options_progs == 0 then
- print("No programs.")
- end
- print(SEPERATOR)
- local inp = io.read()
- inp = tonumber(inp)
- print("Enter program to run: (ex. 3)\n")
- shell.run("clear")
- term.setCursorPos(1,1)
- print("Loading...")
- os.sleep(1)
- if inp <= #options_main then
- local but = options_main[inp]
- if but.label == "Shell" then
- shell.run("clear")
- print(SEPERATOR)
- print("Frogpulp OS - Shell")
- print(SEPERATOR.."\nReboot to return to OS.\n\n")
- osActive = false
- return
- else
- print("Running program...")
- if not fs.exists(but.file) then shell.run("pastebin run "..but.file) end
- shell.run(but.file)
- end
- elseif inp > #options_main then
- shell.run(PROGDIR..options_progs[inp-#options_main])
- else
- print("Unrecognized input...")
- os.sleep(0.5)
- return
- end
- end
- function makeStartup(text) -- new
- if fs.exists("startup.lua") then shell.run("delete startup.lua"); end
- local file = fs.open("startup.lua","w")
- file.write(text)
- file.close()
- end
- repeat Main() until osActive == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement