Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- reboot.lua
- -- 1) wipe everything except /rom
- -- 2) pastebin get 7jWUHDLX it
- -- 3) run it
- local function wipe_all_but_rom()
- local entries = fs.list("/")
- for _, name in ipairs(entries) do
- if name ~= "rom" then
- local path = "/" .. name
- -- fs.delete is recursive for directories
- pcall(fs.delete, path)
- end
- end
- end
- local function pastebin_get(id, out)
- -- Prefer shell.execute (returns ok, reason) if present; fallback to shell.run (bool)
- if shell.execute then
- local ok, reason = shell.execute("pastebin", "get", id, out)
- if not ok then error("pastebin get failed: " .. tostring(reason)) end
- else
- local ok = shell.run("pastebin", "get", id, out)
- if not ok then error("pastebin get failed (is HTTP enabled?)") end
- end
- end
- local function run_file(path)
- -- Run as a program so it gets its own environment
- local ok, reason = shell.run(path)
- if not ok then error("failed to run " .. path .. ": " .. tostring(reason)) end
- end
- -- ---------- main ----------
- print("Wiping filesystem (except /rom)...")
- wipe_all_but_rom()
- print("Downloading init from Pastebin...")
- pastebin_get("7jWUHDLX", "init")
- print("Running init...")
- run_file("init")
Advertisement
Add Comment
Please, Sign In to add comment