Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --NDF-OS Updater
- if not http then
- error("This requires the HTTP API to be enabled, please enable it.", 2)
- end
- if not term.isColor and not term.isColor() then
- if os.getVersion() == "CraftOS 1.3" then
- error("Sorry this OS can only run on Computers with CraftOS 1.4 and above.", 2)
- end
- error("Sorry this OS can only run on Advanced Computers", 2)
- end
- local function upWrite(path, text)
- local file = assert(io.open(path, "w"))
- file:write(text)
- file:close()
- end
- local function prerequisits()
- if fs.exists(".var/.icons/.iconcfg") then
- fs.copy(".var/.icons/.iconcfg", "iconcfg")
- end
- if fs.exists(".var/settings") then
- fs.copy(".var/settings", "settings")
- end
- if fs.exists(".var/.cver") then
- fs.delete("documents")
- fs.delete(".var")
- fs.delete("programs")
- fs.delete(".trash")
- fs.delete("startup")
- end
- fs.makeDir("documents/")
- fs.makeDir("documents/pictures/")
- fs.makeDir("documents/projects/")
- fs.makeDir("documents/text/")
- fs.makeDir(".var/")
- fs.makeDir(".var/.icons")
- fs.makeDir("programs/")
- fs.makeDir("programs/.system/")
- fs.makeDir(".trash/")
- fs.makeDir(".var/.boot/")
- fs.makeDir(".var/.install")
- fs.makeDir("programs/games/")
- fs.makeDir("programs/games/speeder/")
- fs.makeDir("programs/games/speeder/sprites/")
- fs.makeDir("programs/games/speeder/world/")
- if fs.exists("settings") then
- fs.copy("settings", ".var/settings")
- fs.delete("settings")
- end
- if fs.exists("iconcfg") then
- fs.copy("iconcfg", ".var/.icons/.iconcfg")
- fs.delete("iconcfg")
- end
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/10.nfp") -- Install Progress 10
- upWrite(".var/.install/10.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/20.nfp") -- Install Progress 20
- upWrite(".var/.install/20.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/30.nfp") -- Install Progress 30
- upWrite(".var/.install/30.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/40.nfp") -- Install Progress 40
- upWrite(".var/.install/40.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/50.nfp") -- Install Progress 50
- upWrite(".var/.install/50.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/60.nfp") -- Install Progress 60
- upWrite(".var/.install/60.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/70.nfp") -- Install Progress 70
- upWrite(".var/.install/70.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/80.nfp") -- Install Progress 80
- upWrite(".var/.install/80.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/90.nfp") -- Install Progress 90
- upWrite(".var/.install/90.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.install/100.nfp") -- Install Progress 100
- upWrite(".var/.install/100.nfp", osEVer.readAll())
- osEVer.close()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/10.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Downloading Prerequisits...")
- end
- local function Var()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/20.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Downloading System Files...")
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.trash/items") -- Trash
- upWrite(".trash/items", Ekern.readAll())
- Ekern.close()
- local Estartup = http.get("http://cc.ndfjay.co.uk/NDFOS/startup") -- Startup
- upWrite("startup", Estartup.readAll())
- Estartup.close()
- local Egui = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/gui") -- GUI
- upWrite(".var/gui", Egui.readAll())
- Egui.close()
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/kernal") -- Kernal
- upWrite(".var/kernal", Ekern.readAll())
- Ekern.close()
- if not fs.exists(".var/settings") then -- Settings
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/settings")
- upWrite(".var/settings", Ekern.readAll())
- Ekern.close()
- end
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.ss") -- Screensaver
- upWrite(".var/.ss", osEVer.readAll())
- osEVer.close()
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/uaconf") -- Local User Accounts
- upWrite(".var/uaconf", Ekern.readAll())
- Ekern.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/feedback") -- Feedback Apt
- upWrite(".var/feedback", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/feedback.nfp") --Feedback Style
- upWrite(".var/feedback.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/about.nfp") -- About Style
- upWrite(".var/about.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/filemanager") -- File Browser by BigSHinyToys
- upWrite(".var/filemanager", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.adsnt.dll") -- Cloud Connection Details
- upWrite(".var/.adsnt.dll", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/install") -- Installer/updater
- upWrite(".var/install", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/ver") -- Current Version
- upWrite(".var/ver", osEVer.readAll())
- osEVer.close()
- fs.copy(".var/ver", ".var/.cver")
- if not fs.exists(".var/.icons/.iconcfg") then -- Icon Config
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/.iconcfg")
- upWrite(".var/.icons/.iconcfg", osEVer.readAll())
- osEVer.close()
- end
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot1.nfp") -- Boot Animation frame 1
- upWrite(".var/.boot/Boot1.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot2.nfp") -- Boot Animation frame 2
- upWrite(".var/.boot/Boot2.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot3.nfp") -- Boot Animation frame 3
- upWrite(".var/.boot/Boot3.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot4.nfp") -- Boot Animation frame 4
- upWrite(".var/.boot/Boot4.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.boot/Boot5.nfp") -- Boot Animation frame 5
- upWrite(".var/.boot/Boot5.nfp", osEVer.readAll())
- osEVer.close()
- end
- local function Icons()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/30.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Setting up Run-Time Environment...")
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/FireWolf.nfp") -- FireWolf
- upWrite(".var/.icons/FireWolf.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/Speeder.nfp") -- Speeder
- upWrite(".var/.icons/Speeder.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/nPaintPro.nfp") -- nPaintPro
- upWrite(".var/.icons/nPaintPro.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/.var/.icons/icon.nfp") -- Generic Icon
- upWrite(".var/.icons/icon.nfp", osEVer.readAll())
- osEVer.close()
- sleep(3)
- end
- local function Documents()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/40.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Configuring Local storage and Cloud...")
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/documents/pictures/.background") -- NDF-OS Background
- upWrite("documents/pictures/.background", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/documents/pictures/.backgroundCC") -- ComputerCraft Background
- upWrite("documents/pictures/.backgroundCC", osEVer.readAll())
- osEVer.close()
- end
- local function Programs()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/70.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Setting up System Programs...")
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/control.nse") -- Control Panel
- upWrite("programs/.system/control.nse", Ekern.readAll())
- Ekern.close()
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/firewolf.nse") -- FireWolf
- upWrite("programs/.system/firewolf.nse", Ekern.readAll())
- Ekern.close()
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/npaintpro.nse") -- nPaintPro
- upWrite("programs/.system/npaintpro.nse", Ekern.readAll())
- Ekern.close()
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/paintsplash.spl") -- nPaintPro Menu
- upWrite("programs/.system/paintsplash.spl", Ekern.readAll())
- Ekern.close()
- local Ekern = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/.system/word.nse") -- NotePad (Note-Taker)
- upWrite("programs/.system/word.nse", Ekern.readAll())
- Ekern.close()
- end
- local function Games()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/90.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Installing Games...")
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/speeder") -- Game Speeder
- upWrite("programs/games/speeder/speeder", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/world/road.nfp") -- Game Speeder Road
- upWrite("programs/games/speeder/world/road.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/1.nfp") -- Game Speader Car 1
- upWrite("programs/games/speeder/sprites/1.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/2.nfp") -- Game Speader Car 2
- upWrite("programs/games/speeder/sprites/2.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/3.nfp") -- Game Speader Car 3
- upWrite("programs/games/speeder/sprites/3.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/4.nfp") -- Game Speader Car 4
- upWrite("programs/games/speeder/sprites/4.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/5.nfp") -- Game Speader Car 5
- upWrite("programs/games/speeder/sprites/5.nfp", osEVer.readAll())
- osEVer.close()
- local osEVer = http.get("http://cc.ndfjay.co.uk/NDFOS/programs/games/speeder/sprites/player.nfp") -- Game Speeder Player
- upWrite("programs/games/speeder/sprites/player.nfp", osEVer.readAll())
- osEVer.close()
- end
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(10, 8)
- term.setTextColor(256)
- print("Gathering required Files, Please wait...")
- sleep(.5)
- prerequisits()
- Var()
- Icons()
- Documents()
- Programs()
- Games()
- term.setBackgroundColor(1)
- term.clear()
- image = paintutils.loadImage(".var/.install/100.nfp")
- paintutils.drawImage(image,1 ,1)
- term.setCursorPos(13,18)
- term.setBackgroundColor(1)
- term.setTextColor(256)
- print("Preparing System for Boot...")
- sleep(.8)
- if fs.exists(".var/.boot/Boot1.nfp") then
- os.reboot()
- else
- shell.run(".var/install")
- end
Advertisement
Add Comment
Please, Sign In to add comment