diff --git a/src/main/resources/assets/opencomputers/loot/network/.prop b/src/main/resources/assets/opencomputers/loot/network/.prop new file mode 100644 index 000000000..cea2062f9 --- /dev/null +++ b/src/main/resources/assets/opencomputers/loot/network/.prop @@ -0,0 +1 @@ +{fromDir="/data/"} diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/cp.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/cp.lua index 6f2ba1d07..2387ab37b 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/cp.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/cp.lua @@ -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 diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/install.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/install.lua index 65029f329..d063cc208 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/install.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/install.lua @@ -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 diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_basics.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_basics.lua index 13848399f..8c0a8cd42 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_basics.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_basics.lua @@ -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 diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_utils.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_utils.lua index d8db67bc6..68cd2bce5 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_utils.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/tools/install_utils.lua @@ -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 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"