Added self install script.

This commit is contained in:
Andrew Lalis 2023-08-29 08:03:06 -04:00
parent a3ddb06e07
commit fdedf74ddc
1 changed files with 11 additions and 1 deletions

View File

@ -72,7 +72,8 @@ local function createUser(name, password)
if not validatePassword(password) then return false, "Invalid password" end
if userExists(name) then return false, "Username taken" end
local userData = {
password = password
password = password,
createdAt = os.epoch("utc")
}
fs.makeDir(userDir(name))
local dataFile = io.open(userDataFile(name), "w")
@ -108,6 +109,15 @@ local function renameUser(oldName, newName)
return true
end
local args = {...}
if args[1] == "-i" then
print("Reinstalling from GitHub.")
fs.delete("bank.lua")
shell.execute("wget", "https://raw.githubusercontent.com/andrewlalis/kp-bank/main/bank.lua")
shell.execute("bank.lua")
end
rednet.open("modem")
rednet.host("BANK", "central-bank")