-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.lua
40 lines (32 loc) · 1.07 KB
/
bootstrap.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
local function sync_file(source_url, target_file)
if fs.exists(target_file) then
return "Bootstrap: can't run, file conflict"
end
local ok, err = http.checkURL( source_url )
if not ok then
return err
end
local response = http.get( source_url , nil , true )
if not response then
return "no response for requested URL "..source_url
end
local s_response = response.readAll()
response.close()
print("Opening "..target_file)
local file = fs.open( target_file, "wb" )
file.write( s_response )
file.close()
return nil
end
local err = sync_file("https://raw.githubusercontent.com/margaretdax/CitadelOS/master/citadel_rom/citadel_os.lua", "citadel_rom/citadel_os.lua")
if err ~= nil then
print("Error: "..err)
return
end
err = sync_file("https://raw.githubusercontent.com/margaretdax/CitadelOS/master/citadel_rom/programs/install.lua", "citadel_rom/programs/install.lua")
if err ~= nil then
print("Error: "..err)
return
end
shell.setPath(shell.path()..":/citadel_rom/programs")
shell.run("install")