View difference between Paste ID: b02ZhWGd and SKKkYK7f
SHOW: | | - or go back to the newest paste.
1-
function udprog(updateprogram, pastelink, udloc, updatefunargs, startupls)
1+
2
fupdateargs = {...} 
3-
--fupdateargs = {...} 
3+
4-
updateargs = updatefunargs
4+
5-
os.loadAPI("/rom/programs/shell.lua")
5+
6
    end
7
    os.run({}, "cd", udloc)
8
9
10-
    shell.shell.run("cd", udloc)
10+
11
        shell.run("delete",updateprogram.."new") 
12
    end
13
    shell.run("pastebin","get",pastelink,updateprogram.."new")
14-
        shell.shell.run("delete",updateprogram.."new") 
14+
15
        if fs.exists(updateprogram.."old") then
16-
    shell.shell.run("pastebin","get",pastelink,updateprogram.."new")
16+
            shell.run("delete",updateprogram.."old")
17
        end
18
        if fs.exists("Farm") then
19-
            shell.shell.run("delete",updateprogram.."old")
19+
            shell.run("rename",updateprogram,updateprogram.."old")
20
        end
21
        shell.run("rename",updateprogram.."new",updateprogram)
22-
            shell.shell.run("rename",updateprogram,updateprogram.."old")
22+
23
            break
24-
        shell.shell.run("rename",updateprogram.."new",updateprogram)
24+
25
    end
26
    if fs.exists(updateprogram) then
27
        if updateloop > 20 then
28
            break
29
        end
30
    end
31
    if fs.exists(updateprogram.."old") then
32
        if updateloop > 30 then
33
            shell.run("rename",updateprogram.."old",updateprogram)
34
            if fs.exists(updateprogram) then
35
                break
36-
            shell.shell.run("rename",updateprogram.."old",updateprogram)
36+
37
        end
38
    end
39
    updateloop = updateloop + 1
40
end
41
local _, countsl = string.gsub(udloc,"/","")
42
countsl = countsl + 1
43
44
if startupls ~= "none" or startupls ~= nil then
45
    local stu = fs.open("startup.lua", "w")
46
    stu.write(startupls)
47
    stu.close()
48
end
49
if updatefunargs ~= nil or updatefunargs ~= "none" then
50
    shell.run(updateprogram .. "," .. unpack(updateargs))
51
else
52
    shell.run(updateprogram)
53-
    shell.shell.run(updateprogram .. "," .. unpack(updateargs))
53+
54
for i=1,countsl do
55-
    shell.shell.run(updateprogram)
55+
    shell.run("cd", "..")
56
end