mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 00:35:56 -04:00
Merge branch 'install-and-shell' of https://github.com/payonel/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
7f55ceabe5
@ -67,9 +67,10 @@ local function recurse(fromPath, toPath, origin)
|
|||||||
local isLink, target = fs.isLink(fromPath)
|
local isLink, target = fs.isLink(fromPath)
|
||||||
local toIsLink, toLinkTarget = fs.isLink(toPath)
|
local toIsLink, toLinkTarget = fs.isLink(toPath)
|
||||||
local same_path = fs.canonical(isLink and target or fromPath) == fs.canonical(toIsLink and toLinkTarget or toPath)
|
local same_path = fs.canonical(isLink and target or fromPath) == fs.canonical(toIsLink and toLinkTarget or toPath)
|
||||||
|
local same_link = isLink and toIsLink and same_path
|
||||||
local toExists = fs.exists(toPath)
|
local toExists = fs.exists(toPath)
|
||||||
|
|
||||||
if isLink and options.P and (not toExists or not same_path) then
|
if isLink and options.P and not (toExists and same_path and not toIsLink) then
|
||||||
if toExists and options.n then
|
if toExists and options.n then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,6 @@ if ec ~= nil and ec ~= 0 then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local write = io.write
|
local write = io.write
|
||||||
local read = io.read
|
|
||||||
write("Installation complete!\n")
|
write("Installation complete!\n")
|
||||||
|
|
||||||
if options.setlabel then
|
if options.setlabel then
|
||||||
@ -39,8 +38,7 @@ end
|
|||||||
|
|
||||||
if options.reboot then
|
if options.reboot then
|
||||||
write("Reboot now? [Y/n] ")
|
write("Reboot now? [Y/n] ")
|
||||||
local result = read() or "n"
|
if ((io.read() or "n").."y"):match("^%s*[Yy]") then
|
||||||
if result:sub(1, 1):lower() == "y" then
|
|
||||||
write("\nRebooting now!\n")
|
write("\nRebooting now!\n")
|
||||||
computer.shutdown(true)
|
computer.shutdown(true)
|
||||||
end
|
end
|
||||||
|
@ -9,6 +9,13 @@ if #dirs == 0 then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local target = shell.resolve(dirs[1])
|
local target = shell.resolve(dirs[1])
|
||||||
|
|
||||||
|
-- don't link from target if it doesn't exist, unless it is a broken link
|
||||||
|
if not fs.exists(target) and not fs.isLink(target) then
|
||||||
|
io.stderr:write("ln: failed to access '" .. target .. "': No such file or directory\n")
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
local linkpath
|
local linkpath
|
||||||
if #dirs > 1 then
|
if #dirs > 1 then
|
||||||
linkpath = shell.resolve(dirs[2])
|
linkpath = shell.resolve(dirs[2])
|
||||||
|
@ -666,28 +666,34 @@ function --[[@delayloaded-start@]] sh.internal.hasValidPiping(words, pipes)
|
|||||||
local semi_split = tx.find(text.syntax, {";"}) -- all symbols before ; in syntax CAN be repeated
|
local semi_split = tx.find(text.syntax, {";"}) -- all symbols before ; in syntax CAN be repeated
|
||||||
pipes = pipes or tx.sub(text.syntax, semi_split + 1)
|
pipes = pipes or tx.sub(text.syntax, semi_split + 1)
|
||||||
|
|
||||||
local pies = tx.select(words, function(parts, i)
|
local state = "" -- cannot start on a pipe
|
||||||
return #parts == 1 and #text.split(parts[1].txt, pipes, true) == 0 and true or false
|
|
||||||
end)
|
for w=1,#words do
|
||||||
|
local word = words[w]
|
||||||
local bad_pipe
|
for p=1,#word do
|
||||||
local last = 0
|
local part = word[p]
|
||||||
for k,v in ipairs(pies) do
|
if part.qr then
|
||||||
if v then
|
state = nil
|
||||||
if k-last == 1 then
|
elseif part.txt == "" then
|
||||||
bad_pipe = words[k][1].txt
|
state = nil -- not sure how this is possible (empty part without quotes?)
|
||||||
break
|
elseif #text.split(part.txt, pipes, true) == 0 then
|
||||||
|
local prev = state
|
||||||
|
state = part.txt
|
||||||
|
if prev then -- cannot have two pipes in a row
|
||||||
|
word = nil
|
||||||
|
break
|
||||||
|
end
|
||||||
|
else
|
||||||
|
state = nil
|
||||||
end
|
end
|
||||||
last=k
|
end
|
||||||
|
if not word then -- bad pipe
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not bad_pipe and last == #pies then
|
if state then
|
||||||
bad_pipe = words[last][1].txt
|
return false, "parse error near " .. state
|
||||||
end
|
|
||||||
|
|
||||||
if bad_pipe then
|
|
||||||
return false, "parse error near " .. bad_pipe
|
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,6 @@ local unicode = require("unicode")
|
|||||||
local text = require("text")
|
local text = require("text")
|
||||||
|
|
||||||
local write = io.write
|
local write = io.write
|
||||||
local read = io.read
|
|
||||||
|
|
||||||
local args, options = shell.parse(...)
|
local args, options = shell.parse(...)
|
||||||
|
|
||||||
@ -174,7 +173,7 @@ options.source_dir = fs.canonical(source.prop.fromDir or options.fromDir or "")
|
|||||||
|
|
||||||
local installer_path = options.source_root .. "/.install"
|
local installer_path = options.source_root .. "/.install"
|
||||||
if fs.exists(installer_path) then
|
if fs.exists(installer_path) then
|
||||||
return loadfile("/lib/tools/install_utils.lua", "bt", _G)('install', options)
|
os.exit(loadfile("/lib/tools/install_utils.lua", "bt", _G)('install', options))
|
||||||
end
|
end
|
||||||
|
|
||||||
local cp_args =
|
local cp_args =
|
||||||
@ -190,8 +189,7 @@ if #options.targets > 1 or options.to then
|
|||||||
special_target = " to " .. cp_args[3]
|
special_target = " to " .. cp_args[3]
|
||||||
end
|
end
|
||||||
io.write("Install " .. source_display .. special_target .. "? [Y/n] ")
|
io.write("Install " .. source_display .. special_target .. "? [Y/n] ")
|
||||||
local choice = read():lower()
|
if not ((io.read() or "n").."y"):match("^%s*[Yy]") then
|
||||||
if choice ~= "y" and choice ~= "" then
|
|
||||||
write("Installation cancelled\n")
|
write("Installation cancelled\n")
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
|
@ -22,8 +22,8 @@ local function select_prompt(devs, prompt)
|
|||||||
io.write("Enter 'q' to cancel the installation: ")
|
io.write("Enter 'q' to cancel the installation: ")
|
||||||
choice = nil
|
choice = nil
|
||||||
while not choice do
|
while not choice do
|
||||||
result = io.read()
|
result = io.read() or "q"
|
||||||
if result:sub(1, 1):lower() == "q" then
|
if result == "q" then
|
||||||
os.exit()
|
os.exit()
|
||||||
end
|
end
|
||||||
local number = tonumber(result)
|
local number = tonumber(result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user