mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-08 23:06:58 -04:00
fix motd without gpu
hide some irrelavent luacheck warnings
This commit is contained in:
parent
bf7636f533
commit
0cdaf8c87d
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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.
|
||||
|
@ -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*$")
|
||||
|
@ -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)
|
||||
|
@ -335,6 +335,7 @@ function filesystem.setAutorunEnabled(value)
|
||||
saveConfig()
|
||||
end
|
||||
|
||||
-- luacheck: globals os
|
||||
os.remove = filesystem.remove
|
||||
os.rename = filesystem.rename
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user