-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstaller.lua
More file actions
81 lines (79 loc) · 2.28 KB
/
Installer.lua
File metadata and controls
81 lines (79 loc) · 2.28 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
os.pullEvent = os.pullEventRaw
term.clear()
version = http.get("https://raw.githubusercontent.com/NiftyNarwhal11/ModularOS/refs/heads/main/latestVersion").readLine()
local stringtoboolean={ ["true"]=true, ["false"]=false }
-- Installer Function
installerf = function(code, file)
print("Installing from GitHub")
downloader = http.get("https://raw.githubusercontent.com/NiftyNarwhal11/ModularOS/refs/heads/main/" .. code)
if downloader then
input = io.open(file, "w")
input:write(downloader.readAll())
input:close()
term.setCursorPos( 16,3 )
print("Downloaded file"..code)
sleep(2)
return true
else
print("Download Failed Error Check HTTP . . .")
end
end
-- End of function
-- Installers go here:
installerf(".os/.password.lua", "/.os/.password.lua")
installerf("packagebrowser.lua", "/packagebrowser.lua")
term.clear()
function install()
term.clear()
shell.run("set shell.allow_disk_startup false")
term.clear()
term.setCursorPos( 1,1 )
end
install()
sleep(2)
term.setCursorPos( 16, 6 )
--Install startup Script
installerf("startup/STARTUP.lua", "/startup/STARTUP")
term.setCursorPos(1,1)
term.clear()
print(">Do you want to auto-update the software?(Enter true or false)")
write(">")
print()
local autoupdate = string.lower(read())
print("Set Username")
write(">")
local username = read()
print()
print("Set Password")
write(">")
local password = read()
settings.load(".settings")
settings.define("MOS.auto-update.enabled", {
description = "Weather to auto update the software or not",
default = true,
type = bool,
})
settings.define("MOS.user.username", {
description = "Username for ModularOS.",
default = "admin",
type = "string",
})
settings.define("MOS.user.password", {
description = "Password for ModularOS.",
default = "root",
type = "string",
})
settings.define("MOS.version", {
description = "Version of ModularOS.",
default = "0.0.0",
type = "string",
})
settings.set("MOS.auto-update.enable", stringtoboolean[autoupdate])
settings.set("MOS.user.username", username)
settings.set("MOS.user.password", password)
settings.set("MOS.version", version)
settings.save(".settings")
--set up folders--
fs.makeDir(".programs")
shell.setPath(("%s:/.programs"):format(shell.path()))
install()