Merge branch 'install-nil-check' of https://github.com/payonel/OpenComputers into master-MC1.7.10

This commit is contained in:
Florian Nücke 2016-06-15 21:35:57 +02:00
commit c9e6ddcbd3
5 changed files with 20 additions and 17 deletions

View File

@ -0,0 +1 @@
{fromDir="/data/"}

View File

@ -19,17 +19,11 @@ end
local exit_code = nil
options.P = options.P or options.r
-- interrupting is important, but not EVERY copy
local greedy = computer.uptime()
local function status(from, to)
if options.v then
io.write(from .. " -> " .. to .. "\n")
end
if computer.uptime() - greedy > 4 then
os.sleep(0) -- allow interrupting
greedy = computer.uptime()
end
os.sleep(0) -- allow interrupting
end
local result, reason

View File

@ -8,6 +8,8 @@ do
options = basic(...)
end
if not options then return end
if computer.freeMemory() < 50000 then
print("Low memory, collecting garbage")
for i=1,20 do os.sleep(0) end

View File

@ -51,7 +51,7 @@ local function cleanPath(path)
if path then
local rpath = shell.resolve(path)
if fs.isDirectory(rpath) then
return fs.canonical(rpath):gsub("/+$", "") .. '/'
return fs.canonical(rpath) .. '/'
end
end
end
@ -84,8 +84,7 @@ up_deprecate('name', 'label')
options.source_root = cleanPath(options.from)
options.target_root = cleanPath(options.to)
options.source_dir = (options.fromDir or "") .. '.'
options.target_dir = (options.root or options.toDir or "")
options.target_dir = fs.canonical(options.root or options.toDir or "")
options.update = options.u or options.update
@ -167,10 +166,11 @@ if not target then return end
options.target_root = options.target_root or target.path
-- now that source is selected, we can update options
options.label = options.label or source.prop.label
options.setlabel = source.prop.setlabel and not options.nosetlabel
options.setboot = source.prop.setboot and not options.nosetboot
options.reboot = source.prop.reboot and not options.noreboot
options.label = options.label or source.prop.label
options.setlabel = source.prop.setlabel and not options.nosetlabel
options.setboot = source.prop.setboot and not options.nosetboot
options.reboot = source.prop.reboot and not options.noreboot
options.source_dir = fs.canonical(source.prop.fromDir or options.fromDir or "") .. '/.'
local installer_path = options.source_root .. "/.install"
if fs.exists(installer_path) then

View File

@ -1,11 +1,11 @@
local cmd, options = ...
local function select_prompt(devs, direction)
local function select_prompt(devs, prompt)
table.sort(devs, function(a, b) return a.path<b.path end)
local choice = devs[1]
if #devs > 1 then
io.write("Select the device to install " .. direction .. '\n')
print(prompt)
for i = 1, #devs do
local src = devs[i]
@ -59,7 +59,13 @@ if cmd == 'select' then
os.exit(1)
end
return select_prompt(options.sources, "from"), select_prompt(options.targets, "to")
local source = select_prompt(options.sources, "What do you want to install?")
if #options.sources > 1 and #options.targets > 1 then
print()
end
local target = select_prompt(options.targets, "Where do you want to install to?")
return source, target
elseif cmd == 'install' then
local installer_path = options.source_root .. "/.install"