Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ver = 1.0.2 - Clunker5 Patched
- local progName = "Random"
- local bProblem = false
- local function varifing()
- local sParth = shell.getRunningProgram()
- print("Parth:"..sParth)
- if fs.getName(sParth) == "startup" then
- local sDir = string.sub(sParth,1,#sParth-8)
- print("Disk: "..sDir)
- if fs.exists(sDir..[[\]].."install") then
- print("Found Install folder")
- file = io.open(sDir..[[\]].."install"..[[\]].."LIST","r")
- local tInstruction = {}
- local last = file:read()
- repeat
- table.insert(tInstruction,last)
- last = file:read()
- print(last)
- until last == nil
- file:close()
- -- check that files are avalible
- local tNames = {}
- local tParths = {}
- print("Cheking LIST :")
- local termX,termY = term.getCursorPos()
- for i = 1,#tInstruction do
- term.setCursorPos(termX,termY)
- term.clearLine()
- write("Completed: "..tostring((100/#tInstruction)*i)..[[ %]])
- if math.fmod(i,2) == 1 then -- odd number
- table.insert(tNames,tInstruction[i])
- else -- even number
- table.insert(tParths,tInstruction[i])
- end
- end
- local proceed = true
- for i = 1,#tNames do
- if fs.exists(sDir..[[\]].."install"..[[\]]..tNames[i]) then
- else
- proceed = false
- end
- end
- if #tNames == #tParths then
- else
- proceed = false
- end
- if proceed then
- --local tFileList = fs.list(sDir..[[\]].."install")
- print("\nInstalling ...")
- termX,termY = term.getCursorPos()
- for i = 1,#tNames do
- term.setCursorPos(termX,termY)
- term.clearLine()
- write("Completed: "..tostring((100/#tNames)*i)..[[ %]])
- local temp = tParths[i] -- ..[[\]]..tNames[i]
- if fs.exists(temp) then -- fs.delete
- fs.delete(temp)
- end
- local temp2 = string.sub(temp,1,#temp - (string.len(fs.getName(temp))+1))
- if fs.isDir(temp2) then
- else
- fs.makeDir(temp2)
- end
- fs.copy(sDir..[[\]].."install"..[[\]]..tNames[i],tParths[i])
- end
- print("\nInstall Completed")
- else
- print("[ERROR] installer varification failed")
- end
- else
- print("ERROR")
- end
- end
- end
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Welcom to Quick Install ver: "..ver)
- print("[WARNING] Will override existing Files")
- if bProblem then
- print("Please select y Y n or N ")
- bProblem = false
- end
- write("Do you want to install "..progName..[[ Y/N ]])
- local selection = string.lower(read())
- if selection == "y" then
- print("varifing Install")
- varifing()
- break
- elseif selection == "n" then
- print("Install aborted")
- break
- else
- bProblem = true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement