FEATURES
- After running the program it will verify that you want to continue to avoid accidental erasure of your files. Default option is set to "NO" for this purpose.
- Program will format the system and remove all files and folders that are not read only protected.
- The System Restore program will ignore the disk drive all together as the program itself must reside on a disk to function properly. (Have not tested if it works while on the system itself yet.)
- After formatting the system it will add folders designated by the program.
- Recovers files designated in the program directly from Pastebin.
- Once completed the system will reboot and your system should be restored according to the files and folders designated.
- Ctrl-T is disallowed once the the process has begun to avoid damaging the system.
- Easy to modify to suit your needs. Easy to manipulate functions at the beginning of the program allow you to add, modify or remove files or folders.
- Clean GUI to make this program easy to use for any level of user.
- Integration into an overall OS where the system boots and does a system check. (memory, file structure etc.) If the check fails it will initiate a system restore sequence from disk to restore the system to it's previous state including any back-up files saved.
- Clean up program and add any additional fail safes to prevent program crashes or failures in file downloading.
Spoiler
term.clear()
term.setCursorPos(1,1)
sid = 0
rep = 0
rep2 = 0
pbfile = 0
function mkdir()
shell.run("mkdir /pending")
shell.run("mkdir /users")
end
function sysrest()
while rep2 <= 3 do
if pbfile == 0 then
sCode = "tK3ikweu"
sFile = "login"
elseif pbfile == 1 then
sCode = "daTg13eG"
sFile = "pb"
elseif pbfile == 2 then
sCode = "tt4xZhjX"
sFile = "system"
elseif pbfile == 3 then
sCode = "mciJr52F"
sFile = "startup"
end
local sPath = ("/".. sFile)
local response = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode(sCode))
if response then
local sResponse = response.readAll()
response.close()
local file = fs.open(sPath, "w")
file.write(sResponse)
file.close()
pbfile = pbfile+1
rep2 = rep2+1
else
rep2 = 4
end
end
end
function format()
for _, f in pairs(fs.list("/")) do
if not fs.isReadOnly(f) then
fs.delete(f)
end
end
end
function timer()
sleep(0.2) write(".")
sleep(0.2) write(".")
sleep(0.2) write(".")
sleep(0.3) write(" DONE!")
sleep(0.3)
end
function clear()
term.clear()
term.setCursorPos(1,1)
end
function menu(id, text)
if sid == id then
write(">> ")
else
write(" ")
end
print(text)
end
while rep == 0 do
clear()
print("|=================================================|")
print("| BouTech System Restore v1.3 |")
print("|=================================================|")
term.setCursorPos(19,5)
print(":: WARNING! ::")
print(" This action will erase ALL data currently on this ")
print(" system and restore files for the ")
print(" BouTech Managment System ")
print("")
print(" Continue with system restore? ")
term.setCursorPos(16,11)
menu(0, "NO")
term.setCursorPos(29,11)
menu(1, "YES")
event, key = os.pullEvent("key")
if key == 205 then
if sid == 0 then
sid = 1
elseif sid == 1 then
sid = 0
end
elseif key == 203 then
if sid == 0 then
sid = 1
elseif sid == 1 then
sid = 0
end
elseif key == 28 then
if sid == 1 then
if not http then
term.setCursorPos(1,14)
print("|=================================================|")
print("| HTTP API must be enabled to restore system. |")
print("| Set enableAPI_http to true in ComputerCraft.cfg |")
print("| System will now reboot. |")
print("|=================================================|")
sleep(3)
return
end
clear()
os.pullEvent = os.pullEventRaw
print("|=================================================|")
print("| BouTech System Restore v1.3 |")
print("|=================================================|")
term.setCursorPos(10,5)
print(":: SYSTEM RESTORE IN PROGRESS! ::")
sleep(0.5)
term.setCursorPos(17,7)
write("Formatting")
timer()
format()
term.setCursorPos(15,8)
write("Adding Folders")
timer()
mkdir()
term.setCursorPos(14,9)
write("Recovering Files")
timer()
sysrest()
term.setCursorPos(9,10)
write("Installing Files To System")
timer()
sleep(1)
term.setCursorPos(1,17)
write("|=================================================|")
write("| Restore complete. System will now reboot. |")
write("|=================================================|")
sleep(2)
rep = 1
clear()
os.reboot()
elseif sid == 0 then
term.setCursorPos(1, 17)
print("|=================================================|")
print("| Restore canceled. System will now reboot. |")
print("|=================================================|")
sleep(2)
rep = 1
clear()
os.reboot()
end
end
end
PASTEBIN
- Pastebin get 8sbPWVgA or go to Pastebin.
No screenshots yet as I do not feel they are necessary but if you feel you need some post here and request some.