-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstaller.lua
65 lines (55 loc) · 1.68 KB
/
installer.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local files = {
'sigils.lua',
'sigils/CacheMap.lua',
'sigils/concurrent.lua',
'sigils/controller.lua',
'sigils/factory.lua',
'sigils/filter.lua',
'sigils/ItemDetailAndLimitCache.lua',
'sigils/logging.lua',
'sigils/machine.lua',
'sigils/machines/chest.lua',
'sigils/machines/fluidtank.lua',
'sigils/machines/generic.lua',
'sigils/pipe.lua',
'sigils/pipeModes/fluid.lua',
'sigils/pipeModes/natural.lua',
'sigils/pipeModes/spread.lua',
'sigils/utils.lua',
'sigils/websocket.lua',
'sigils/sigils-config.dist.json',
}
write('Downloading SIGILS...')
local tasks = {}
for i, path in ipairs(files) do
tasks[i] = function()
local req, err = http.get('https://raw.githubusercontent.com/fechan/SIGILS/master/computercraft/' .. path)
if not req then error('Failed to download ' .. path .. ': ' .. err, 0) end
local file = fs.open('.sigils/' .. path, 'w')
file.write(req.readAll())
file.close()
req.close()
end
end
parallel.waitForAll(table.unpack(tasks))
print(' done')
print()
io.open('sigils.lua', 'w'):write("shell.run('.sigils/sigils.lua')"):close()
local writeStartup
while writeStartup == nil do
print('Run SIGILS when the computer starts up? (press y/n)')
print('(If not, you must manually restart SIGILS if the chunk is unloaded.)')
local event, char = os.pullEvent('char')
print(char)
if string.lower(char) == 'y' then
writeStartup = true
elseif string.lower(char) == 'n' then
writeStartup = false
end
end
if writeStartup then
print('SIGILS will now run on startup.')
io.open('startup', 'w'):write("shell.run('.sigils/sigils.lua')"):close()
end
print()
print('SIGILS successfully installed! Run /sigils.lua to start.')