-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathinstall.lua
More file actions
55 lines (48 loc) · 1.31 KB
/
install.lua
File metadata and controls
55 lines (48 loc) · 1.31 KB
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
local shell = require("shell")
local filesystem = require("filesystem")
local args = {...}
local scripts = {
"action.lua",
"database.lua",
"gps.lua",
"posUtil.lua",
"scanner.lua",
"signal.lua",
"autoStat.lua",
"autoCrossbreed.lua",
"autoSpread.lua",
"install.lua"
}
local function exists(filename)
return filesystem.exists(shell.getWorkingDirectory().."/"..filename)
end
local branch
local option
if #args == 0 then
branch = "main"
else
branch = args[1]
end
if branch == "help" then
print("Usage:\n./install or ./install [branch] [updateconfig]")
return
end
if #args == 2 then
option = args[2]
end
for i=1, #scripts do
shell.execute("wget -f https://raw.githubusercontent.com/xyqyear/auto-crossbreeding/"..branch.."/"..scripts[i])
end
if not exists("config.lua") then
shell.execute("wget https://raw.githubusercontent.com/xyqyear/auto-crossbreeding/"..branch.."/config.lua")
end
if option == "updateconfig" then
if exists("config.lua") then
if exists("config.bak") then
shell.execute("rm config.bak")
end
shell.execute("mv config.lua config.bak")
print("Moved config.lua to config.bak")
end
shell.execute("wget https://raw.githubusercontent.com/xyqyear/auto-crossbreeding/"..branch.."/config.lua")
end