Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define colors
- local bgColor = colors.black
- local textColor = colors.white
- local headerColor = colors.blue
- local infoColor = colors.green
- -- Clear the screen and set background color
- term.setBackgroundColor(bgColor)
- term.clear()
- term.setCursorPos(1, 1)
- -- Function to print a header with a background color
- local function printHeader(text)
- term.setTextColor(headerColor)
- term.setBackgroundColor(bgColor)
- print(text)
- term.setTextColor(textColor)
- end
- -- Function to print info with colors
- local function printInfo(label, value)
- term.setTextColor(infoColor)
- term.write(label .. ": ")
- term.setTextColor(textColor)
- print(value)
- end
- -- Display ASCII art
- term.setTextColor(headerColor)
- print(" |\\_/|")
- print(" | @ @ DEVICE INFORMATION ")
- print(" | <> _ ")
- print(" | _/\\------____ ((| |))")
- print(" | `--' | ")
- print(" ____|_ ___| |___.' ")
- print("/_/_____/____/_______|")
- -- Function to read config file using Lua's loadfile
- local function readConfig()
- local configFilePath = "/disk/bootloader/system.config"
- if fs.exists(configFilePath) then
- local config = loadfile(configFilePath)()
- if type(config) == "table" then
- return config
- else
- return {} -- Return an empty table if the format is incorrect
- end
- end
- return {} -- Return an empty table if the file does not exist
- end
- -- Function to get the device info
- local function getDeviceInfo()
- local config = readConfig() -- Read config from Lua file
- local id = os.getComputerID() or "Unknown ID"
- local label = os.getComputerLabel() or "No Label"
- local osVersion = config.os_version or "Unknown OS Version"
- local bootloaderVersion = config.bootloader_version or "Unknown Bootloader Version"
- local securityPatch = config.security_patch or "Unknown Security Patch"
- local recoveryPartition = fs.exists("/recovery/") and "Recovery partition exists" or "No Recovery partition"
- return {
- id = id,
- label = label,
- osVersion = osVersion,
- bootloaderVersion = bootloaderVersion,
- securityPatch = securityPatch,
- recoveryPartition = recoveryPartition
- }
- end
- -- Get device info
- local info = getDeviceInfo()
- -- Display device info with better UI
- printHeader("Computer Information:")
- printInfo("Computer ID", info.id)
- printInfo("Computer Label", info.label)
- printHeader("Software Information:")
- printInfo("Doggy OS Version", info.osVersion)
- printInfo("VA11-ILLA Bootloader Version", info.bootloaderVersion)
- printInfo("Security Patch Version", info.securityPatch)
- printHeader("System Information:")
- printInfo("Recovery Partition Status", info.recoveryPartition)
- -- Prompt and wait for Enter key to reboot
- term.setTextColor(colors.yellow)
- term.setTextColor(textColor)
- local input = read()
- if input == "" then
- -- Reboot the computer
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement