SHOW:
|
|
- or go back to the newest paste.
| 1 | --My hideous, ancient installer! Almost a year of service! | |
| 2 | --license: | |
| 3 | --you are free to modify, distribute, and re-license this code. This license does not apply to things downloaded via this code. | |
| 4 | --here's an actually decent installer | |
| 5 | --made in LuaEdit | |
| 6 | --are theyrunning in a tabbed os? | |
| 7 | --[[ | |
| 8 | This is Install Utils by Geforce Fan. It's found @ BvL9rr0N , please get it from there to be sure it's up to date. | |
| 9 | Just paste it into your installer! | |
| 10 | - | function pasteRun(id,aa) |
| 10 | + | |
| 11 | local function pasteRun(id,aa) | |
| 12 | --print(aa) | |
| 13 | aa=aa or {}
| |
| 14 | if not type(id)=="string" then | |
| 15 | return "Must has string!" | |
| 16 | end | |
| 17 | --get program off pastebin | |
| 18 | local a=http.get("http://www.pastebin.com/raw.php?i="..id)
| |
| 19 | if not a then return false end | |
| 20 | a=a.readAll() | |
| 21 | if not a then return false end | |
| 22 | local env = {}
| |
| 23 | a=loadstring(a) | |
| 24 | if not a then return false end | |
| 25 | --local env= setmetatable({},{__index=_G})
| |
| 26 | local env=getfenv() | |
| 27 | setfenv(a,env) | |
| 28 | ||
| 29 | local ok,err=pcall(a,unpack(aa)) | |
| 30 | --a() | |
| 31 | if (not ok) and err then | |
| 32 | printError("Error running "..id..": "..err)
| |
| 33 | return false | |
| 34 | end | |
| 35 | return err,env | |
| 36 | - | function pastePI(id,tab) |
| 36 | + | |
| 37 | local function pastePI(id,tab) | |
| 38 | local returned,env = pasteRun(id) | |
| 39 | _G[tab] = env | |
| 40 | - | function pasteGet(id) |
| 40 | + | |
| 41 | local function pasteGet(id) | |
| 42 | if not type(id)=="string" then | |
| 43 | return "Must has string!" | |
| 44 | end | |
| 45 | --get program off pastebin | |
| 46 | local a=http.get("http://www.pastebin.com/raw.php?i="..id)
| |
| 47 | if not a then return false end | |
| 48 | a=a.readAll() | |
| 49 | if not a then return false end | |
| 50 | return a | |
| 51 | - | function pasteGetAndSave(url,loc) |
| 51 | + | |
| 52 | local function pasteGetAndSave(url,loc) | |
| 53 | local a=pasteGet(url) | |
| 54 | --write it | |
| 55 | local b = fs.open(loc,"w") | |
| 56 | if b then | |
| 57 | b.write(a) | |
| 58 | b.close() | |
| 59 | return true | |
| 60 | end | |
| 61 | return false | |
| 62 | end | |
| 63 | --This is the end of installutils. The rest is this person's installer. | |
| 64 | ||
| 65 | if not term.isColor() then --temporary fix | |
| 66 | function term.setTextColor() return end | |
| 67 | term.setBackgroundColor = term.setTextColor | |
| 68 | end | |
| 69 | ||
| 70 | ||
| 71 | local _,ty=term.getSize() | |
| 72 | local tabbed = true | |
| 73 | if ty == 18 then | |
| 74 | tabbed=true | |
| 75 | end | |
| 76 | pGetNDL= pasteGetAndSave | |
| 77 | local function blankBuf() | |
| 78 | local x,y = term.getSize() | |
| 79 | return window.create(term.native(),1,1,x,y,false) | |
| 80 | end | |
| 81 | local function cPrint(y,text) | |
| 82 | --centerprinttext | |
| 83 | local h=term.getSize() | |
| 84 | h=(h-#text)/2 | |
| 85 | term.setCursorPos(h,y) | |
| 86 | - | cPrint(1,"LimitlessBox V2") |
| 86 | + | |
| 87 | end | |
| 88 | local function drawInsUI() | |
| 89 | term.setBackgroundColor(colors.gray) | |
| 90 | term.clear() | |
| 91 | term.setBackgroundColor(colors.orange) | |
| 92 | term.setTextColor(colors.black) | |
| 93 | term.setCursorPos(1,1) | |
| 94 | print(" ")
| |
| 95 | cPrint(1,"LimitlessBox V3") | |
| 96 | term.setBackgroundColor(colors.gray) | |
| 97 | term.setTextColor(colors.orange) | |
| 98 | --make a box where the info will be displayed | |
| 99 | paintutils.drawLine(2,3,2,18,colors.lightGray) | |
| 100 | paintutils.drawLine(50,3,50,18,colors.lightGray) | |
| 101 | paintutils.drawLine(50,18,2,18,colors.lightGray) | |
| 102 | paintutils.drawLine(50,3,2,3,colors.lightGray) | |
| 103 | --draw next and previos buttons | |
| 104 | term.setBackgroundColor(colors.orange) | |
| 105 | term.setTextColor(colors.black) | |
| 106 | term.setCursorPos(50,ty) | |
| 107 | write">" | |
| 108 | term.setCursorPos(2,ty) | |
| 109 | write"<" | |
| 110 | term.setBackgroundColor(colors.green) | |
| 111 | term.setTextColor(colors.black) | |
| 112 | cPrint(ty,"DOWNLOAD!") | |
| 113 | term.setBackgroundColor(colors.gray) | |
| 114 | term.setTextColor(colors.orange) | |
| 115 | end | |
| 116 | local function appPrint(t) | |
| 117 | local _,y=term.getCursorPos() | |
| 118 | term.setCursorPos(3,y) | |
| 119 | print(t) | |
| 120 | end | |
| 121 | local function handleSapphari() | |
| 122 | cPrint(4,"Sapphari:") | |
| 123 | print() | |
| 124 | print() | |
| 125 | - | cPrint(4,"PokeCC Level Editor:") |
| 125 | + | |
| 126 | - | cPrint(5,"Not out yet.") |
| 126 | + | |
| 127 | appPrint(" Tabs, bookmarks, site switching, etc. ")
| |
| 128 | appPrint(" Welcome to the internet! ")
| |
| 129 | cPrint(11,"Current version: 1.0") | |
| 130 | - | cPrint(4,"Note to users:") |
| 130 | + | |
| 131 | - | cPrint(5,"(this is temporry and will be removed when this space fills)just wanted everyone to know, that as of 1/11/2015 I'm working on Game-engine and will be releasing it soon-ish.") |
| 131 | + | |
| 132 | local function handlePokeCCLevelEditor() | |
| 133 | ||
| 134 | cPrint(4,"Gamedev:") | |
| 135 | cPrint(5,"Keep on goin'...") | |
| 136 | ||
| 137 | end | |
| 138 | local function handlePokeCC() | |
| 139 | cPrint(4,"PokeCC") | |
| 140 | cPrint(5,"You saw nothing.") | |
| 141 | cPrint(6,"Move along, now.") | |
| 142 | ||
| 143 | ||
| 144 | ||
| 145 | ||
| 146 | end | |
| 147 | local function handleGameengine() | |
| 148 | cPrint(4,"Game-Engine") | |
| 149 | cPrint(5,"Sample text, lens-flare!") | |
| 150 | cPrint(6,"See the post in general for info.") | |
| 151 | end | |
| 152 | local function handleOs() | |
| 153 | cPrint(4,"[os]") | |
| 154 | cPrint(5,"Sample text, lens-flare!") | |
| 155 | cPrint(6,"No info on this, in a nobody-will-find-this-beta!") | |
| 156 | - | function gDL(n) |
| 156 | + | |
| 157 | local function handleInstaller() | |
| 158 | --//first draw the UI | |
| 159 | --now pass it off to the current app to install handler | |
| 160 | if args[2] == "update" then--an app is calling this to update | |
| 161 | - | fs.delete("/"..dir.."/Game-Engine")
|
| 161 | + | |
| 162 | - | fs.delete("/"..dir.."/testgame")
|
| 162 | + | |
| 163 | - | fs.makeDir("/"..dir.."/Game-Engine")
|
| 163 | + | |
| 164 | - | pasteRun("6aMMzdwd",{"AI221", "Game-Engine", "master", "/"..dir.."/Game-Engine",})
|
| 164 | + | |
| 165 | end | |
| 166 | - | os.loadAPI("/"..dir.."/Game-Engine/redirect")
|
| 166 | + | local function gDL() |
| 167 | - | os.loadAPI("/"..dir.."/Game-Engine/game")
|
| 167 | + | |
| 168 | pastePI("4nRg9CHU","json")
| |
| 169 | - | local f=fs.open("/"..dir.."/Game-Engine/stOld","r")
|
| 169 | + | |
| 170 | dir=dir or "" | |
| 171 | -- Remove any previous versions in this directory | |
| 172 | fs.delete(""..dir.."/Game-Engine")
| |
| 173 | fs.delete(""..dir.."/testgame")
| |
| 174 | fs.makeDir(""..dir.."/Game-Engine")
| |
| 175 | - | game.save("/"..dir.."/secondTown",a)
|
| 175 | + | pasteRun("W5ZkVYSi",{"AI221", "Game-Engine", "master", "/"..dir.."/Game-Engine",})
|
| 176 | pasteGetAndSave("fU9Kj9zr","/"..dir.."/Game-Engine/redirect")
| |
| 177 | - | fs.delete("/"..dir.."/Game-Engine/stOld")
|
| 177 | + | os.loadAPI(""..dir.."/Game-Engine/redirect")
|
| 178 | os.loadAPI(""..dir.."/Game-Engine/game")
| |
| 179 | --load the map | |
| 180 | local f=fs.open(""..dir.."/Game-Engine/stOld","r")
| |
| 181 | if f then | |
| 182 | - | fs.move("/"..dir.."/Game-Engine/testgame","/"..dir.."testgame")
|
| 182 | + | |
| 183 | - | if not n then |
| 183 | + | |
| 184 | - | local i=quitw() |
| 184 | + | |
| 185 | - | if i then |
| 185 | + | |
| 186 | - | term.setBackgroundColor(colors.black) |
| 186 | + | game.save(""..dir.."/secondTown",a)
|
| 187 | - | term.setTextColor(colors.yellow) |
| 187 | + | |
| 188 | - | term.clear() |
| 188 | + | fs.delete(""..dir.."/Game-Engine/stOld")
|
| 189 | - | term.setCursorPos(1,1) |
| 189 | + | |
| 190 | - | print(os.version()) |
| 190 | + | |
| 191 | - | return i |
| 191 | + | |
| 192 | --move testgame | |
| 193 | fs.move(""..dir.."/Game-Engine/testgame","/"..dir.."testgame")
| |
| 194 | end | |
| 195 | args = {...}
| |
| 196 | function handleWhichApp() | |
| 197 | while true do--don't feel like reindenting | |
| 198 | drawInsUI() | |
| 199 | --local currentApp={}
| |
| 200 | - | if not args[1] then |
| 200 | + | args[1] = tonumber(args[1]) or 4 |
| 201 | - | args[1]=1 |
| 201 | + | |
| 202 | - | else |
| 202 | + | |
| 203 | - | args[1]=tonumber(args[1]) |
| 203 | + | |
| 204 | --currentApp[2] ="handlePokeCCLevelEditor" | |
| 205 | handlePokeCC() | |
| 206 | elseif args[1]==3 then | |
| 207 | --currentApp[3]="handlePokeCC" | |
| 208 | handlePokeCCLevelEditor() | |
| 209 | elseif args[1]==4 then | |
| 210 | handleGameengine() | |
| 211 | elseif args[1]==5 then | |
| 212 | handleOs() | |
| 213 | ||
| 214 | end | |
| 215 | local evt,type,x,y=os.pullEvent() | |
| 216 | if evt=='mouse_click'then | |
| 217 | if y==ty then | |
| 218 | if x==2 then | |
| 219 | if args[1]>1 then | |
| 220 | args[1]=args[1]-1 | |
| 221 | end | |
| 222 | elseif x==50 then | |
| 223 | if args[1]<5 then | |
| 224 | args[1]=args[1]+1 | |
| 225 | end | |
| 226 | elseif x>20 and x<30 then | |
| 227 | term.setBackgroundColor(colors.green) | |
| 228 | term.setTextColor(colors.black) | |
| 229 | cPrint(19,"DLing... ") | |
| 230 | local buf = blankBuf() | |
| 231 | --dlbutton | |
| 232 | if args[1]==1 then | |
| 233 | --sapph dl | |
| 234 | if not fs.exists("sapphInt") then
| |
| 235 | fs.makeDir("sapphInt")
| |
| 236 | end | |
| 237 | fs.delete"sapphInt/startup" | |
| 238 | fs.delete"sapphInt/sapphUtils" | |
| 239 | fs.delete"sapphInt/redirect" | |
| 240 | pGetNDL('fJ409KH1','sapphInt/startup')
| |
| 241 | pGetNDL("fU9Kj9zr","sapphInt/redirect")
| |
| 242 | pGetNDL("hyNPyhQZ","sapphInt/sapphUtils")
| |
| 243 | local ff=fs.open("sapphInt/sapphBookmarks","w")
| |
| 244 | local bo = {}
| |
| 245 | bo[1] = "Add Bookmark" | |
| 246 | ff.writeLine(textutils.serialize(bo)) | |
| 247 | - | local bo = {}
|
| 247 | + | ff.close() |
| 248 | - | bo[1] = "Add Bookmark" |
| 248 | + | --make a shortcut to sapphari |
| 249 | - | ff.writeLine(textutils.serialize(bo)) |
| 249 | + | |
| 250 | - | ff.close() |
| 250 | + | ff.writeLine('shell.run("sapphInt/startup")')
|
| 251 | - | --make a shortcut to sapphari |
| 251 | + | ff.close() |
| 252 | cPrint(ty,"DOWNLOAD!") | |
| 253 | - | ff.writeLine('shell.run("sapphInt/startup")')
|
| 253 | + | local i=quitw() |
| 254 | - | ff.close() |
| 254 | + | |
| 255 | term.setBackgroundColor(colors.black) | |
| 256 | - | local i=quitw() |
| 256 | + | |
| 257 | term.clear() | |
| 258 | term.setCursorPos(1,1) | |
| 259 | print(os.version()) | |
| 260 | return i | |
| 261 | end | |
| 262 | elseif args[1]==2 then | |
| 263 | --pokecc dl | |
| 264 | ||
| 265 | elseif args[1]==3 then | |
| 266 | --levels dl | |
| 267 | ||
| 268 | elseif args[1]==4 then | |
| 269 | local cur = term.current() | |
| 270 | term.redirect(buf) | |
| 271 | --game-engine dl | |
| 272 | local a = gDL() | |
| 273 | - | gDL() |
| 273 | + | term.redirect(cur) |
| 274 | if quitw() then | |
| 275 | term.setBackgroundColor(colors.black) | |
| 276 | - | gDL(true) |
| 276 | + | |
| 277 | term.clear() | |
| 278 | - | pasteRun("6aMMzdwd",{"AI221","-os-","master"})
|
| 278 | + | |
| 279 | - | pasteGetAndSave("5CpA2rrQ","/library/nevardon")
|
| 279 | + | |
| 280 | return | |
| 281 | end | |
| 282 | - | local i=quitw() |
| 282 | + | |
| 283 | --[os] install | |
| 284 | term.redirect(buf) | |
| 285 | gDL() | |
| 286 | if args[3] == "slow" then -- Sometimes github doesn't like download 2 things this quickly | |
| 287 | sleep(30) | |
| 288 | end | |
| 289 | fs.makeDir("/library")
| |
| 290 | pasteRun("W5ZkVYSi",{"AI221","-os-","master"})
| |
| 291 | fs.makeDir"/library/acc" | |
| 292 | fs.makeDir"/library/acc/admin" | |
| 293 | if args[3] == "slow" then | |
| 294 | sleep(30) -- I think it might be the http api | |
| 295 | end | |
| 296 | pasteGetAndSave("5CpA2rrQ","/library/programs/edit")
| |
| 297 | ||
| 298 | os.reboot() | |
| 299 | --[[local i=quitw() | |
| 300 | if i then | |
| 301 | term.setBackgroundColor(colors.black) | |
| 302 | term.setTextColor(colors.yellow) | |
| 303 | term.clear() | |
| 304 | term.setCursorPos(1,1) | |
| 305 | print(os.version()) | |
| 306 | return i | |
| 307 | end]] | |
| 308 | end | |
| 309 | end | |
| 310 | end | |
| 311 | end | |
| 312 | end | |
| 313 | end--for the while loop. | |
| 314 | ||
| 315 | function quitw() | |
| 316 | --check if updating via app | |
| 317 | if args[2]=="update" then | |
| 318 | term.setBackgroundColor(colors.black) | |
| 319 | term.clear() | |
| 320 | term.setCursorPos(1,1) | |
| 321 | return "update"--this tells the app it was sucsessful | |
| 322 | end | |
| 323 | --draw a prompt | |
| 324 | --we want this centered, so we'll use a trick' | |
| 325 | term.setBackgroundColor(colors.lightGray) | |
| 326 | term.setTextColor(colors.black) | |
| 327 | cPrint(9," Quit? ") | |
| 328 | term.setBackgroundColor(colors.orange) | |
| 329 | cPrint(10,"Do you want") | |
| 330 | cPrint(11,"to quit? ") | |
| 331 | --give the user the option | |
| 332 | term.setBackgroundColor(colors.orange) | |
| 333 | cPrint(12," Yes No ") | |
| 334 | --fix the mess-up | |
| 335 | term.setBackgroundColor(colors.orange) | |
| 336 | term.setCursorPos(20,12) | |
| 337 | write" " | |
| 338 | --we must do it manual now | |
| 339 | term.setCursorPos(25,12) | |
| 340 | write" " | |
| 341 | term.setCursorPos(29,12) | |
| 342 | print" " | |
| 343 | ||
| 344 | --check for button press | |
| 345 | while true do | |
| 346 | local _,_,x,y=os.pullEvent() | |
| 347 | if y==12 then | |
| 348 | if x>21 and x<26 then | |
| 349 | if json then | |
| 350 | os.unloadAPI"json" | |
| 351 | end | |
| 352 | return true | |
| 353 | elseif x>27 and x<30 then | |
| 354 | return false | |
| 355 | end | |
| 356 | end | |
| 357 | end | |
| 358 | end | |
| 359 | --if they're on a smaller screen we can't show them our fancy UI. | |
| 360 | local x,y=term.getSize() | |
| 361 | if x == 51 then else | |
| 362 | args[2]="update" | |
| 363 | end | |
| 364 | if y==19 then else--or y==18 then else--for OSes with a menubar, fine. not sure how they'll dl, will get to that later probs | |
| 365 | args[2]="update" | |
| 366 | end | |
| 367 | return handleInstaller() |