55 lines
1.0 KiB
Lua
55 lines
1.0 KiB
Lua
local LIST_FILES = {
|
|
'miner.lua',
|
|
'simple-harvester.lua',
|
|
'inferium-upgrader.lua'
|
|
};
|
|
|
|
local LIST_LIBS_FILES = {
|
|
'libs/turtle-utils.lua',
|
|
'libs/robot.lua'
|
|
}
|
|
|
|
local LIST_CONFIG_FILES = {
|
|
'startup.lua',
|
|
'config/config-miner.lua'
|
|
}
|
|
|
|
|
|
local REPO_PREFIX = 'https://git.trapcloud.fr/guillaumearm/minecraft-cc-tools/raw/branch/master/'
|
|
|
|
|
|
local prepareDirs = function()
|
|
fs.makeDir('/libs')
|
|
fs.makeDir('/config')
|
|
end
|
|
|
|
local installFiles = function(list)
|
|
for _, filePath in pairs(list) do
|
|
fs.delete(filePath)
|
|
shell.execute('wget', REPO_PREFIX .. filePath, filePath)
|
|
end
|
|
end
|
|
|
|
local installConfig = function()
|
|
-- do not override existing config files
|
|
for _, filePath in pairs(LIST_CONFIG_FILES) do
|
|
if not fs.exists(filePath) then
|
|
shell.execute('wget', REPO_PREFIX .. filePath, filePath)
|
|
end
|
|
end
|
|
end
|
|
|
|
local function mainSetup = function()
|
|
local previousDir = shell.dir()
|
|
|
|
prepareDirs()
|
|
installFiles(LIST_LIBS_FILES)
|
|
installFiles(LIST_FILES)
|
|
installConfig()
|
|
|
|
shell.setDir(previousDir)
|
|
end
|
|
|
|
mainSetup()
|
|
|