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/bin/uname

62 lines
1.6 KiB
Text
Raw Permalink Normal View History

2022-07-18 19:33:40 +02:00
local tArgs = {...}
local err = true
local function findArg(arg)
for _,v in ipairs(tArgs) do
if v == arg then
return true
end
end
return false
end
if findArg("--help") or findArg("-h") then
err = false
shell.execute("/bin/man uname")
end
if findArg("--kernel-name") or findArg("-s") then
err = false
kerneldraw.printAppInfo("uname", kernel.getName())
end
if findArg("--nodename") or findArg("-n") then
err = false
kerneldraw.printAppInfo("uname", kernel.getHostname())
end
if findArg("--kernel-release") or findArg("-r") then
err = false
kerneldraw.printAppInfo("uname", kernel.getRelease())
end
if findArg("--kernel-version") or findArg("-v") then
err = false
kerneldraw.printAppInfo("uname", kernel.getVersion())
end
if findArg("--machine") or findArg("-m") then
err = false
kerneldraw.printAppInfo("uname", kernel.getMachine())
end
if findArg("--processor") or findArg("-p") then
err = false
kerneldraw.printAppInfo("uname", kernel.getProcessorArchitecture())
end
if findArg("--hardware-platform") or findArg("-i") then
err = false
kerneldraw.printAppInfo("uname", kernel.getHardwarePlatform())
end
if findArg("--operating-system") or findArg("-o") then
err = false
kerneldraw.printAppInfo("uname", kernel.getOS())
end
if findArg("--path") or findArg("-b") then
err = false
kerneldraw.printAppInfo("uname", shell.path())
end
if findArg("--id") or findArg("-c") then
err = false
kerneldraw.printAppInfo("uname", os.getComputerID())
end
if findArg("--user") or findArg("-u") then
err = false
kerneldraw.printAppInfo("uname", _G[_activeUser])
end
if #tArgs < 1 or err then
kerneldraw.printAppInfo("uname", "Arguments not specified")
end