Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("blueos/") == false then
- fs.makeDir("blueos")
- end
- if fs.exists("blueos/home") == false then
- fs.makeDir("blueos/home")
- end
- if fs.exists("blueos/data") == false then
- local file = fs.open("blueos/data","w")
- file.write("0")
- file.close()
- end
- local file = fs.open("blueos/data","r")
- local startups = file.readLine()
- file.close()
- if tonumber(startups) ~= nil then
- local file = fs.open("blueos/data","w")
- file.write(tostring(startups + 1))
- local startups = startups + 1
- file.close()
- else
- startups = "error"
- end
- term.clear()
- term.setCursorPos(1,2)
- term.setTextColor(colors.blue)
- write("Blue OS")
- local width, height = term.getSize()
- paintutils.drawLine(1,3,width,3,colors.lightGray)
- term.setTextColor(colors.black)
- term.setCursorPos(1,3)
- local motd = {
- [1] = "Blue OS: It's terrible!",
- [2] = "Why are you using this?",
- [3] = "Hey, got anything better to do?",
- [4] = "Made by MinerMan132 (god what have I done)",
- [5] = "Hi diddly ho neighborino!",
- [6] = "Color or colour?",
- [7] = "You've used this terrible OS "..startups.." times!",
- [8] = "The BlueOS help program is simpley called \"help\""
- }
- write(" ")
- print(motd[math.random(1,#motd)])
- print("")
- term.setBackgroundColor(colors.black)
- shell.setDir("blueos/home")
- local function main()
- while true do
- term.setTextColor(colors.blue)
- write(" ")
- if shell.dir() ~= "" then
- write("/")
- end
- write(shell.dir().." > ")
- term.setTextColor(colors.cyan)
- local command = read()
- if command ~= "uninstall" then
- shell.run(command)
- else
- if fs.exists(shell.dir().."/uninstall") then
- print("Do you want to run the program \"uninstall\", instead of uninstalling BlueOS? (y/n)")
- local awnser = read()
- if awnser == "y" or "yes" then
- uninstallc = true
- else
- shell.run("uninstall")
- end
- else
- uninstallc = true
- end
- if uninstallc == true then
- term.setTextColor(colors.blue)
- print("Are you absolutely sure you want to uninstall BlueOS?")
- print("This will delete ALL files you have stored under the BlueOS directory!")
- print("(y/n)")
- term.setTextColor(colors.red)
- local awnser = read()
- if awnser == "y" or awnser == "yes" then
- term.setTextColor(colors.blue)
- print("Final confirmation. Please don't. (y/n)")
- term.setTextColor(colors.red)
- local awnser = read()
- if awnser == "y" or awnser == "yes" then
- write("Ok, bye ")
- sleep(1)
- write(":")
- sleep(1)
- write("'")
- sleep(1)
- write("(")
- sleep(2)
- term.setTextColor(colors.red)
- print("")
- print("Removing Directory")
- fs.delete("blueos/")
- print("Removing Startupfile")
- fs.delete(shell.getRunningProgram())
- else
- term.setTextColor(colors.lightBlue)
- print("Yay! Thanks! :D")
- uninstallc = nil
- end
- else
- uninstallc = nil
- end
- end
- end
- end
- end
- function stop()
- while true do
- local ok, msg = pcall(main)
- if not ok then
- print("")
- printError("Whoopsie it crashed!")
- printError("Error: "..msg)
- term.setTextColor(colors.lightBlue)
- term.setCursorBlink(false)
- print("Restarting in 5 seconds . . .")
- sleep(5)
- os.reboot()
- end
- end
- end
- while true do
- local ok2, msg2 = pcall(stop)
- if not ok then
- term.setTextColor(colors.yellow)
- print("Returning to shell...")
- shell.setDir("")
- sleep(0.3)
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement