-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathft-setup.lua
106 lines (70 loc) · 2.35 KB
/
ft-setup.lua
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
local function setup()
graphics.reset(colors.lightGray, colors.black)
graphics.cPrint("DeltaOS first-time setup")
print("")
graphics.cPrint("I. User setup")
print("")
paintutils.drawLine(2, kernel.y/2, kernel.x-1, kernel.y/2, colors.gray)
paintutils.drawLine(2, kernel.y/2+4, kernel.x-1, kernel.y/2+4, colors.gray)
term.setCursorPos(1, kernel.y/2-1)
term.setBackgroundColor(colors.lightGray)
graphics.cPrint("Username:")
term.setCursorPos(1, kernel.y/2+3)
graphics.cPrint("Password: ")
term.setCursorPos(2, kernel.y/2)
term.setBackgroundColor(colors.gray)
local user = sha256.hash( read() )
term.setCursorPos(2, kernel.y/2+4)
local pass = sha256.hash( read("*") )
users.newUser(user, pass)
graphics.reset(colors.lightGray, colors.black)
graphics.cPrint("DeltaOS first-time setup")
print("")
graphics.cPrint("II. Computer name")
paintutils.drawLine(2, kernel.y/2, kernel.x-1, kernel.y/2, colors.gray)
term.setCursorPos(1, kernel.y/2-2)
term.setBackgroundColor(colors.lightGray)
graphics.cPrint("Computer label/name: ")
term.setCursorPos(2, kernel.y/2)
term.setBackgroundColor(colors.gray)
local label = read()
os.setComputerLabel(label)
graphics.reset(colors.lightGray, colors.black)
graphics.reset(colors.lightGray, colors.black)
graphics.reset(colors.lightGray, colors.black)
graphics.cPrint("First time setup is finished.")
graphics.cPrint("DeltaOS will reboot.")
sleep(0.6)
fs.delete("/system/.setup_trigger")
os.reboot()
end
local x = kernel.catnip(setup)
if x ~= "noErr" then
graphics.reset(colors.blue, colors.white)
print("")
term.setBackgroundColor(colors.white)
term.setBackgroundColor(colors.black)
graphics.cPrint("DeltaOS")
term.setBackgroundColor(colors.blue)
term.setTextColor(colors.black)
print("")
graphics.cPrint("An error has occured.")
graphics.cPrint("The error is: "..x)
print("")
graphics.cPrint("Please report this error to ")
graphics.cPrint("the deltaOS repo.")
print("")
graphics.cPrint("DeltaOS Unstable repo: ")
graphics.cPrint("https://github.com/FlareHAX0R/deltaOS-unstable")
print("")
graphics.cPrint("DeltaOS Stable repo: ")
graphics.cPrint("https://github.com/FlareHAX0R/deltaOS")
print("")
graphics.cPrint("Press any key to continue.")
while true do
local event = os.pullEvent()
if event == "key" or "mouse_click" or "monitor_touch" then
os.reboot()
end
end
end