diff --git a/build.properties b/build.properties index de6d33365..e9d4b2e25 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -oc.version=1.7.3 +oc.version=1.7.4 ae2.version=rv2-beta-26 bc.version=7.0.9 diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/mktmp.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/mktmp.lua index abcc1ec18..9fab5d2dc 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/mktmp.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/mktmp.lua @@ -13,17 +13,18 @@ end local args, ops = shell.parse(...) -local function pop(key) - local result = ops[key] - ops[key] = nil +local function pop(...) + local result + for _,key in ipairs({...}) do + result = ops[key] or result + ops[key] = nil + end return result end local directory = pop('d') -local verbose = pop('v') -verbose = pop('verbose') or verbose -local quiet = pop('q') or quiet -quiet = pop('quiet') or quiet +local verbose = pop('v', 'verbose') +local quiet = pop('q', 'quiet') if pop('help') or #args > 1 or next(ops) then print([[Usage: mktmp [OPTION] [PATH] diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua index aee3d82b2..ae33bd3c9 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/sh.lua @@ -3,20 +3,22 @@ local tty = require("tty") local text = require("text") local sh = require("sh") -local args, options = shell.parse(...) +local args = shell.parse(...) shell.prime() -local needs_profile = io.input().tty -local has_prompt = needs_profile and io.output().tty and not options.c -local input_handler = {hint = sh.hintHandler} if #args == 0 then + local has_profile + local input_handler = {hint = sh.hintHandler} while true do - if has_prompt then - if needs_profile then -- first time run AND interactive - needs_profile = nil + if io.stdin.tty and io.stdout.tty then + if not has_profile then -- first time run AND interactive + has_profile = true dofile("/etc/profile.lua") end + if tty.getCursor() > 1 then + io.write("\n") + end io.write(sh.expand(os.getenv("PS1") or "$ ")) end tty.window.cursor = input_handler @@ -27,6 +29,7 @@ if #args == 0 then if command == "exit" then return elseif command ~= "" then + --luacheck: globals _ENV local result, reason = sh.execute(_ENV, command) if not result then io.stderr:write((reason and tostring(reason) or "unknown error") .. "\n") @@ -35,9 +38,6 @@ if #args == 0 then elseif command == nil then -- false only means the input was interrupted return -- eof end - if has_prompt and tty.getCursor() > 1 then - io.write("\n") - end end else -- execute command. diff --git a/src/main/resources/assets/opencomputers/loot/openos/etc/motd b/src/main/resources/assets/opencomputers/loot/openos/etc/motd index 58c4b014b..0c73a8250 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/etc/motd +++ b/src/main/resources/assets/opencomputers/loot/openos/etc/motd @@ -14,7 +14,7 @@ if f then f:close() greeting = greetings[math.random(1, math.max(#greetings, 1))] or "" end -local width = math.min(#greeting, tty.getViewport() - 5) +local width = math.min(#greeting, (tty.getViewport() or math.huge) - 5) local maxLine = #lines[1] while #greeting > 0 do local si, ei = greeting:sub(1, width):find("%s%S*$") diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua index 904b7e905..4e51bf576 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua @@ -1,8 +1,9 @@ -- called from /init.lua local raw_loadfile = ... -_G._OSVERSION = "OpenOS 1.7.3" +_G._OSVERSION = "OpenOS 1.7.4" +-- luacheck: globals component computer unicode _OSVERSION local component = component local computer = computer local unicode = unicode @@ -20,28 +21,23 @@ computer.shutdown = function(reboot) shutdown(reboot) end -local screen = component.list('screen', true)() -for address in component.list('screen', true) do - if #component.invoke(address, 'getKeyboards') > 0 then - screen = address - break - end -end - -_G.boot_screen = screen - --- Report boot progress if possible. -local gpu = component.list("gpu", true)() local w, h -if gpu and screen then +local screen = component.list("screen", true)() +local gpu = screen and component.list("gpu", true)() +if gpu then gpu = component.proxy(gpu) - gpu.bind(screen) + if not gpu.getScreen() then + gpu.bind(screen) + end + _G.boot_screen = gpu.getScreen() w, h = gpu.maxResolution() gpu.setResolution(w, h) gpu.setBackground(0x000000) gpu.setForeground(0xFFFFFF) gpu.fill(1, 1, w, h, " ") end + +-- Report boot progress if possible. local y = 1 local uptime = computer.uptime -- we actually want to ref the original pullSignal here because /lib/event intercepts it later @@ -49,7 +45,7 @@ local uptime = computer.uptime local pull = computer.pullSignal local last_sleep = uptime() local function status(msg) - if gpu and screen then + if gpu then gpu.set(1, y, msg) if y == h then gpu.copy(1, 2, w, h - 1, 0, -1) diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_filesystem.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_filesystem.lua index 1a67f1763..fdf55dc79 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_filesystem.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/full_filesystem.lua @@ -335,6 +335,7 @@ function filesystem.setAutorunEnabled(value) saveConfig() end +-- luacheck: globals os os.remove = filesystem.remove os.rename = filesystem.rename