SHARE
TWEET

OC Drone Netboot

osmarks May 26th, 2020 (edited) 630 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local net = component.proxy(component.list "internet"())
  2. local eeprom = component.proxy(component.list "eeprom"())
  3.  
  4. local function fetch(url)
  5.     local res, err = net.request(url)
  6.     if not res then error(url .. " error: " .. err) end
  7.     local out = {}
  8.     while true do
  9.         local chunk, err = res.read()
  10.         if err then error(url .. " error: " .. err) end
  11.         if chunk then table.insert(out, chunk)
  12.         else return table.concat(out) end
  13.     end
  14. end
  15.  
  16. local eepromdata = eeprom.getData()
  17. if eepromdata == "" then error "No URL loaded" end
  18. local fn = assert(load(fetch(eepromdata)))
  19. fn()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top