From e83e36201bc52df90efc1f77c0e33d99a55a2894 Mon Sep 17 00:00:00 2001 From: osmarks Date: Thu, 26 Jul 2018 10:48:51 +0100 Subject: [PATCH] add installer --- .gitignore | 2 +- backend-chests.lua | 3 +++ installer.lua | 36 ++++++++++++++++++++++++++++++++++++ mnt/backend-chests.lua | 3 +++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 installer.lua diff --git a/.gitignore b/.gitignore index 6994671..2bf3d44 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -mnt \ No newline at end of file +mnt/* \ No newline at end of file diff --git a/backend-chests.lua b/backend-chests.lua index 7df91ee..bedbbfa 100644 --- a/backend-chests.lua +++ b/backend-chests.lua @@ -1,3 +1,6 @@ +-- Chest backend +-- Currently just the one for Dragon. Will not actually work yet. + local util = require "util" local conf = util.conf diff --git a/installer.lua b/installer.lua new file mode 100644 index 0000000..3402bf1 --- /dev/null +++ b/installer.lua @@ -0,0 +1,36 @@ +local d = _ or require "luadash" + +local wyvern_files = { + root = "https://osmarks.tk/git/osmarks/wyvern/raw/branch/master/", + files = { "installer.lua", "luadash.lua", "lib.lua" } +} + +local ccfuse_files = { + root = "https://raw.githubusercontent.com/apemanzilla/ccfuse/master/client/", + files = { "base64.lua", "json.lua", "ccfuse.lua" } +} + +local args = {...} +local command = d.head(args) +local params = d.tail(args) + +local function download_files(urls) + d.map(urls, function(urls) shell.run("wget", url) end) -- TODO: stop using wget and use actual HTTP/FS API +end + +local function download_group(g) + download_files(d.map(g.files, function(file) return g.root .. file end)) +end + +local function prompt(msg) + write(msg .. "> ") + return read() +end + +local function install_wyvern() download_group(wyvern_files) end +if command == "update" then + install_wyvern() +elseif command == "install" then + install_wyvern() + shell.run "edit wyvern_config.tbl" -- open editor for config edits +end \ No newline at end of file diff --git a/mnt/backend-chests.lua b/mnt/backend-chests.lua index 7df91ee..bedbbfa 100644 --- a/mnt/backend-chests.lua +++ b/mnt/backend-chests.lua @@ -1,3 +1,6 @@ +-- Chest backend +-- Currently just the one for Dragon. Will not actually work yet. + local util = require "util" local conf = util.conf