mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-09 23:38:04 -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
|
minecraft.version=1.7.10
|
||||||
forge.version=10.13.4.1614-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
|
ae2.version=rv2-beta-26
|
||||||
bc.version=7.0.9
|
bc.version=7.0.9
|
||||||
|
@ -13,17 +13,18 @@ end
|
|||||||
|
|
||||||
local args, ops = shell.parse(...)
|
local args, ops = shell.parse(...)
|
||||||
|
|
||||||
local function pop(key)
|
local function pop(...)
|
||||||
local result = ops[key]
|
local result
|
||||||
ops[key] = nil
|
for _,key in ipairs({...}) do
|
||||||
|
result = ops[key] or result
|
||||||
|
ops[key] = nil
|
||||||
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local directory = pop('d')
|
local directory = pop('d')
|
||||||
local verbose = pop('v')
|
local verbose = pop('v', 'verbose')
|
||||||
verbose = pop('verbose') or verbose
|
local quiet = pop('q', 'quiet')
|
||||||
local quiet = pop('q') or quiet
|
|
||||||
quiet = pop('quiet') or quiet
|
|
||||||
|
|
||||||
if pop('help') or #args > 1 or next(ops) then
|
if pop('help') or #args > 1 or next(ops) then
|
||||||
print([[Usage: mktmp [OPTION] [PATH]
|
print([[Usage: mktmp [OPTION] [PATH]
|
||||||
|
@ -3,20 +3,22 @@ local tty = require("tty")
|
|||||||
local text = require("text")
|
local text = require("text")
|
||||||
local sh = require("sh")
|
local sh = require("sh")
|
||||||
|
|
||||||
local args, options = shell.parse(...)
|
local args = shell.parse(...)
|
||||||
|
|
||||||
shell.prime()
|
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
|
if #args == 0 then
|
||||||
|
local has_profile
|
||||||
|
local input_handler = {hint = sh.hintHandler}
|
||||||
while true do
|
while true do
|
||||||
if has_prompt then
|
if io.stdin.tty and io.stdout.tty then
|
||||||
if needs_profile then -- first time run AND interactive
|
if not has_profile then -- first time run AND interactive
|
||||||
needs_profile = nil
|
has_profile = true
|
||||||
dofile("/etc/profile.lua")
|
dofile("/etc/profile.lua")
|
||||||
end
|
end
|
||||||
|
if tty.getCursor() > 1 then
|
||||||
|
io.write("\n")
|
||||||
|
end
|
||||||
io.write(sh.expand(os.getenv("PS1") or "$ "))
|
io.write(sh.expand(os.getenv("PS1") or "$ "))
|
||||||
end
|
end
|
||||||
tty.window.cursor = input_handler
|
tty.window.cursor = input_handler
|
||||||
@ -27,6 +29,7 @@ if #args == 0 then
|
|||||||
if command == "exit" then
|
if command == "exit" then
|
||||||
return
|
return
|
||||||
elseif command ~= "" then
|
elseif command ~= "" then
|
||||||
|
--luacheck: globals _ENV
|
||||||
local result, reason = sh.execute(_ENV, command)
|
local result, reason = sh.execute(_ENV, command)
|
||||||
if not result then
|
if not result then
|
||||||
io.stderr:write((reason and tostring(reason) or "unknown error") .. "\n")
|
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
|
elseif command == nil then -- false only means the input was interrupted
|
||||||
return -- eof
|
return -- eof
|
||||||
end
|
end
|
||||||
if has_prompt and tty.getCursor() > 1 then
|
|
||||||
io.write("\n")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- execute command.
|
-- execute command.
|
||||||
|
@ -14,7 +14,7 @@ if f then
|
|||||||
f:close()
|
f:close()
|
||||||
greeting = greetings[math.random(1, math.max(#greetings, 1))] or ""
|
greeting = greetings[math.random(1, math.max(#greetings, 1))] or ""
|
||||||
end
|
end
|
||||||
local width = math.min(#greeting, tty.getViewport() - 5)
|
local width = math.min(#greeting, (tty.getViewport() or math.huge) - 5)
|
||||||
local maxLine = #lines[1]
|
local maxLine = #lines[1]
|
||||||
while #greeting > 0 do
|
while #greeting > 0 do
|
||||||
local si, ei = greeting:sub(1, width):find("%s%S*$")
|
local si, ei = greeting:sub(1, width):find("%s%S*$")
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
-- called from /init.lua
|
-- called from /init.lua
|
||||||
local raw_loadfile = ...
|
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 component = component
|
||||||
local computer = computer
|
local computer = computer
|
||||||
local unicode = unicode
|
local unicode = unicode
|
||||||
@ -20,28 +21,23 @@ computer.shutdown = function(reboot)
|
|||||||
shutdown(reboot)
|
shutdown(reboot)
|
||||||
end
|
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
|
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 = component.proxy(gpu)
|
||||||
gpu.bind(screen)
|
if not gpu.getScreen() then
|
||||||
|
gpu.bind(screen)
|
||||||
|
end
|
||||||
|
_G.boot_screen = gpu.getScreen()
|
||||||
w, h = gpu.maxResolution()
|
w, h = gpu.maxResolution()
|
||||||
gpu.setResolution(w, h)
|
gpu.setResolution(w, h)
|
||||||
gpu.setBackground(0x000000)
|
gpu.setBackground(0x000000)
|
||||||
gpu.setForeground(0xFFFFFF)
|
gpu.setForeground(0xFFFFFF)
|
||||||
gpu.fill(1, 1, w, h, " ")
|
gpu.fill(1, 1, w, h, " ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Report boot progress if possible.
|
||||||
local y = 1
|
local y = 1
|
||||||
local uptime = computer.uptime
|
local uptime = computer.uptime
|
||||||
-- we actually want to ref the original pullSignal here because /lib/event intercepts it later
|
-- 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 pull = computer.pullSignal
|
||||||
local last_sleep = uptime()
|
local last_sleep = uptime()
|
||||||
local function status(msg)
|
local function status(msg)
|
||||||
if gpu and screen then
|
if gpu then
|
||||||
gpu.set(1, y, msg)
|
gpu.set(1, y, msg)
|
||||||
if y == h then
|
if y == h then
|
||||||
gpu.copy(1, 2, w, h - 1, 0, -1)
|
gpu.copy(1, 2, w, h - 1, 0, -1)
|
||||||
|
@ -335,6 +335,7 @@ function filesystem.setAutorunEnabled(value)
|
|||||||
saveConfig()
|
saveConfig()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- luacheck: globals os
|
||||||
os.remove = filesystem.remove
|
os.remove = filesystem.remove
|
||||||
os.rename = filesystem.rename
|
os.rename = filesystem.rename
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user