mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 16:57:32 -04:00
Merge branch 'install-nil-check' of https://github.com/payonel/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
c9e6ddcbd3
@ -0,0 +1 @@
|
|||||||
|
{fromDir="/data/"}
|
@ -19,17 +19,11 @@ end
|
|||||||
local exit_code = nil
|
local exit_code = nil
|
||||||
options.P = options.P or options.r
|
options.P = options.P or options.r
|
||||||
|
|
||||||
-- interrupting is important, but not EVERY copy
|
|
||||||
local greedy = computer.uptime()
|
|
||||||
|
|
||||||
local function status(from, to)
|
local function status(from, to)
|
||||||
if options.v then
|
if options.v then
|
||||||
io.write(from .. " -> " .. to .. "\n")
|
io.write(from .. " -> " .. to .. "\n")
|
||||||
end
|
end
|
||||||
if computer.uptime() - greedy > 4 then
|
os.sleep(0) -- allow interrupting
|
||||||
os.sleep(0) -- allow interrupting
|
|
||||||
greedy = computer.uptime()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local result, reason
|
local result, reason
|
||||||
|
@ -8,6 +8,8 @@ do
|
|||||||
options = basic(...)
|
options = basic(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not options then return end
|
||||||
|
|
||||||
if computer.freeMemory() < 50000 then
|
if computer.freeMemory() < 50000 then
|
||||||
print("Low memory, collecting garbage")
|
print("Low memory, collecting garbage")
|
||||||
for i=1,20 do os.sleep(0) end
|
for i=1,20 do os.sleep(0) end
|
||||||
|
@ -51,7 +51,7 @@ local function cleanPath(path)
|
|||||||
if path then
|
if path then
|
||||||
local rpath = shell.resolve(path)
|
local rpath = shell.resolve(path)
|
||||||
if fs.isDirectory(rpath) then
|
if fs.isDirectory(rpath) then
|
||||||
return fs.canonical(rpath):gsub("/+$", "") .. '/'
|
return fs.canonical(rpath) .. '/'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -84,8 +84,7 @@ up_deprecate('name', 'label')
|
|||||||
options.source_root = cleanPath(options.from)
|
options.source_root = cleanPath(options.from)
|
||||||
options.target_root = cleanPath(options.to)
|
options.target_root = cleanPath(options.to)
|
||||||
|
|
||||||
options.source_dir = (options.fromDir or "") .. '.'
|
options.target_dir = fs.canonical(options.root or options.toDir or "")
|
||||||
options.target_dir = (options.root or options.toDir or "")
|
|
||||||
|
|
||||||
options.update = options.u or options.update
|
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
|
options.target_root = options.target_root or target.path
|
||||||
|
|
||||||
-- now that source is selected, we can update options
|
-- now that source is selected, we can update options
|
||||||
options.label = options.label or source.prop.label
|
options.label = options.label or source.prop.label
|
||||||
options.setlabel = source.prop.setlabel and not options.nosetlabel
|
options.setlabel = source.prop.setlabel and not options.nosetlabel
|
||||||
options.setboot = source.prop.setboot and not options.nosetboot
|
options.setboot = source.prop.setboot and not options.nosetboot
|
||||||
options.reboot = source.prop.reboot and not options.noreboot
|
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"
|
local installer_path = options.source_root .. "/.install"
|
||||||
if fs.exists(installer_path) then
|
if fs.exists(installer_path) then
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
local cmd, options = ...
|
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)
|
table.sort(devs, function(a, b) return a.path<b.path end)
|
||||||
|
|
||||||
local choice = devs[1]
|
local choice = devs[1]
|
||||||
if #devs > 1 then
|
if #devs > 1 then
|
||||||
io.write("Select the device to install " .. direction .. '\n')
|
print(prompt)
|
||||||
|
|
||||||
for i = 1, #devs do
|
for i = 1, #devs do
|
||||||
local src = devs[i]
|
local src = devs[i]
|
||||||
@ -59,7 +59,13 @@ if cmd == 'select' then
|
|||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
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
|
elseif cmd == 'install' then
|
||||||
local installer_path = options.source_root .. "/.install"
|
local installer_path = options.source_root .. "/.install"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user