This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
FREAX/sbin/shutdown
2022-07-18 19:33:40 +02:00

39 lines
No EOL
697 B
Text

local tArgs = {...}
local err = true
local reboot = false
local poweroff = false
local halt = false
local remTemp = true
local function findArg(arg)
for _,v in ipairs(tArgs) do
if v == arg then
return true
end
end
return false
end
if findArg("-r") or findArg("--reboot") then
err = false
reboot = true
end
if findArg("-p") or findArg("--poweroff") then
err = false
poweroff = true
end
if findArg("-h") or findArg("--halt") then
err = false
halt = true
end
if #tArgs < 1 or err then
kerneldraw.printAppInfo("shutdown", "Arguments not specified")
return
end
if reboot then
kernel.reboot(remTemp)
elseif poweroff then
kernel.poweroff(remTemp)
elseif halt then
kernel.halt()
end