-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.lua
More file actions
167 lines (160 loc) · 5.23 KB
/
install.lua
File metadata and controls
167 lines (160 loc) · 5.23 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
term.clear()
term.setCursorPos(1,1)
local maj = false
local exBootloader = false
local step = 0
local updateList = {
"u071",
"u072",
"u073"
}
print("Ce programme va bien télécharger et installer les fichiers pour FrOS.")
print("Veuillez ne pas éteindre votre ordinateur lors du téléchargement.")
if fs.exists("/FrOS/boot.lua") then
while step == 0 do
print("Voulez-vous mettre à jour ou installer à nouveau ? (maj/install)")
write("? ")
local choix = read()
if choix == "maj" then
step = step + 3
maj = true
exBootloader = false
elseif choix == "install" then
step = step + 1
maj = false
end
end
else
step = step + 1
end
while step == 1 do
print("Utilisez-vous un bootloader ? (oui/non)")
write("? ")
choix = read()
if choix == "oui" then
step = step + 1
exBootloader = true
elseif choix == "non" then
step = step + 1
exBootloader = false
end
end
textutils.slowPrint("-------------------------------------------------")
local function installGithub(filename)
print("Télécharge " .. filename .. " depuis Github.")
local downloader = http.get("https://raw.githubusercontent.com/Timoh5709/FrOS/refs/heads/main/" .. filename)
if downloader then
local input = io.open(filename, "w")
input:write(downloader.readAll())
input:close()
print("Téléchargement de ".. filename .. " réussi")
return true
else
print("Erreur lors du téléchargement du fichier : " .. filename)
end
end
local function getVer()
local file = "FrOS/version.txt"
local handle = fs.open(file, "r")
if not handle then
print("Erreur : Fichier 'FrOS/version.txt' illisible.")
return
end
local ver = handle.readAll()
handle.close()
return ver
end
term.setBackgroundColor(colors.blue)
term.clear()
term.setCursorPos(1,1)
fs.makeDir("FrOS")
print("Dossier FrOS créé avec succès.")
installGithub("FrOS/main.lua")
installGithub("FrOS/version.txt")
fs.makeDir("FrOS/media")
print("Dossier FrOS/media créé avec succès.")
installGithub("FrOS/media/startup.dfpwm")
installGithub("FrOS/media/shutdown.dfpwm")
installGithub("FrOS/media/error.dfpwm")
installGithub("FrOS/media/ask.dfpwm")
fs.makeDir("FrOS/sys")
print("Dossier FrOS/sys créé avec succès.")
installGithub("FrOS/sys/textViewer.lua")
installGithub("FrOS/sys/update.lua")
installGithub("FrOS/sys/repair.lua")
installGithub("FrOS/sys/statusBar.lua")
installGithub("FrOS/sys/httpViewer.lua")
installGithub("FrOS/sys/dfpwmPlayer.lua")
installGithub("FrOS/sys/progressBar.lua")
installGithub("FrOS/sys/utf8.lua")
installGithub("FrOS/sys/loc.lua")
installGithub("FrOS/sys/FZIP.lua")
installGithub("FrOS/sys/script.lua")
installGithub("FrOS/sys/gfrx.lua")
installGithub("FrOS/sys/offline-installer.lua")
fs.makeDir("FrOS/localization")
print("Dossier FrOS/localization créé avec succès.")
installGithub("FrOS/localization/main.loc")
installGithub("FrOS/localization/error.loc")
installGithub("FrOS/localization/sys.loc")
installGithub("FrOS/localization/update.loc")
fs.makeDir("FrOS/drivers")
print("Dossier FrOS/drivers créé avec succès.")
installGithub("FrOS/drivers/init.lua")
fs.makeDir("apps")
print("Dossier apps créé avec succès.")
installGithub("apps/appStore.lua")
installGithub("apps/manuel.lua")
local f = fs.open("FrOS/updateList.txt", "w")
if f then
for k, v in pairs(updateList) do
f.writeLine(v)
end
f.close()
print("Fichier FrOS/updateList.txt créé avec succès.")
else
print("Erreur : Impossible de créer le fichier FrOS/updateList.txt.")
end
if not maj then
local f = fs.open("FrOS/appList.txt", "w")
if f then
f.write("apps/appStore.lua\napps/manuel.lua\n")
f.close()
print("Fichier FrOS/appList.txt créé avec succès.")
else
print("Erreur : Impossible de créer le fichier FrOS/appList.txt.")
end
local f = fs.open("FrOS/driversList.txt", "w")
if f then
f.close()
print("Fichier FrOS/driversList.txt créé avec succès.")
else
print("Erreur : Impossible de créer le fichier FrOS/driversList.txt.")
end
installGithub("FrOS/config.stg")
if not exBootloader then
local f = fs.open("boot.txt", "w")
if f then
f.write("CraftOS|rom/startup.lua\nFrOS|FrOS/boot.lua\n")
f.close()
print("Fichier boot.txt créé avec succès.")
else
print("Erreur : Impossible de créer le fichier boot.txt.")
end
end
print("Voulez-vous installer des drivers ? (oui/non)")
write("? ")
local choix = read()
if choix == "oui" then
print("Pour regarder la liste des drivers, faites 'liste ndrivers' et installez les avec 'driver <nom du driver>'.")
shell.run("/apps/appStore.lua -install")
end
end
fs.makeDir("temp")
print("Dossier temp créé avec succès.")
installGithub("FrOS/boot.lua")
if not exBootloader then
installGithub("startup.lua")
end
print("Installation de FrOS version " .. getVer() .. " terminée. Votre ordinateur va redémarrer.")
os.reboot()