Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This is my OS called M-OS.
- --It is pretty simple. But, it is fast, and easy to use!
- --I hope you enjoy my OS!
- fs.delete("boot")
- fs.delete("setup")
- function installingData(file)
- term.setCursorPos(1,19)
- term.clearLine()
- print("Installing: " .. file)
- end
- local function get(repoFile,saveTo)
- local download = http.get("https://raw.githubusercontent.com/MarcoPolo0306/M-OS/master/"..repoFile)
- installingData(saveTo)
- if download then
- local handle = download.readAll()
- download.close()
- local file = fs.open(saveTo,"w")
- file.write(handle)
- file.close()
- else
- print("Unable to download the file "..repoFile)
- print("Make sure you have the HTTP API enabled or")
- print("an internet connection!")
- end
- end
- w,h = term.getSize()
- slc = 0
- function menu()
- term.setCursorPos(1,1)
- paintutils.drawFilledBox(1,1,w, h, colors.white)
- paintutils.drawLine(1,1,w, 1, colors.lightBlue)
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lightBlue)
- print(" M-OS Setup")
- end
- function welcomeScreen()
- slc = 1
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(8,3)
- print("Welcome to the M-OS installer.")
- term.setCursorPos(8,4)
- print('Click the "Next" button to continue.')
- term.setCursorPos(36,14)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lightGray)
- print(" Next ")
- end
- function copy()
- slc = 0
- term.setBackgroundColor(colors.black)
- term.clear()
- menu()
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(8,3)
- print("Backing up old files...")
- end
- function installingData(msg)
- term.setCursorPos(1,18)
- term.setBackgroundColor(colors.white)
- term.clearLine()
- term.setTextColor(colors.lightGray)
- print("Installing: " .. msg)
- end
- function setPos()
- term.setCursorPos(1,-100)
- end
- function install()
- slc = 2
- term.setBackgroundColor(colors.black)
- term.clear()
- menu()
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(8,3)
- print("M-OS is installing...")
- setPos()
- get("startup","startup")
- get("m-os/boot","m-os/boot")
- get("m-os/desktop","m-os/desktop")
- get("m-os/logon","m-os/logon")
- get("m-os/monitior_detected","m-os/monitior_detected")
- get("m-os/restore","m-os/restore")
- get("m-os/settings","m-os/settings")
- get("m-os/shutdown","m-os/shutdown")
- get("m-os/config/bgPath","m-os/config/bgPath")
- get("m-os/config/pass","m-os/config/pass")
- get("m-os/config/showBiosOnStartup","m-os/config/showBiosOnStartup")
- get("m-os/config/updateOnStartup","m-os/config/updateOnStartup")
- get("m-os/config/theme","m-os/config/theme")
- get("m-os/images/logo","m-os/images/logo")
- get("m-os/images/backgrounds/cc","m-os/images/backgrounds/cc")
- get("m-os/images/backgrounds/default","m-os/images/backgrounds/default")
- get("m-os/images/backgrounds/mc","m-os/images/backgrounds/mc")
- get("m-os/images/icons/file","m-os/images/icons/file")
- get("m-os/images/icons/shell","m-os/images/icons/shell")
- get("m-os/images/icons/unknown","m-os/images/icons/unknown")
- get("m-os/images/icons/paint","m-os/images/icons/paint")
- get("m-os/images/icons/nPaint","m-os/images/icons/nPaint")
- get("m-os/images/UserPiciture","m-os/images/UserPiciture")
- get("m-os/images/default-preview","m-os/images/default-preview")
- get("m-os/images/mc-preview","m-os/images/mc-preview")
- get("m-os/programs/appstore","m-os/programs/appstore")
- get("m-os/programs/file_browser","m-os/programs/file_browser")
- get("m-os/programs/installed_programs","m-os/programs/installed_programs")
- get("m-os/programs/mshell","m-os/programs/mshell")
- get("m-os/programs/news","m-os/programs/news")
- get("m-os/programs/programs","m-os/programs/programs")
- get("setup2","setup2")
- get("boot","boot")
- finish()
- end
- function finish()
- slc = 3
- term.setBackgroundColor(colors.black)
- term.clear()
- menu()
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(8,3)
- print("Thank you for intalling M-OS.")
- term.setCursorPos(8,4)
- print("Click Reboot to continue the setup.")
- term.setCursorPos(36,14)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lightGray)
- print(" Reboot ")
- end
- term.setBackgroundColor(colors.black)
- term.clear()
- menu()
- welcomeScreen()
- while true do
- local event, button, X, Y = os.pullEvent()
- if event == "mouse_click" then
- if X>=36 and X<=41 and Y==14 and button ==1 and slc == 1 then
- if fs.exists("m-os") then
- copy()
- if fs.exists(".m-os_BACKUP") then
- fs.delete(".m-os_BACKUP")
- end
- shell.run("cp","m-os",".m-os_BACKUP")
- fs.delete("m-os")
- sleep(1)
- install()
- else
- install()
- end
- elseif X>=36 and X<=44 and Y==14 and slc == 3 then
- fs.delete("install")
- shell.run("boot")
- end
- end
- if src == 2 then
- input = read()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement