Advertisement
DOGGYWOOF

Doggy OS Version

Sep 6th, 2024 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. -- Define colors
  2. local bgColor = colors.black
  3. local textColor = colors.white
  4. local headerColor = colors.blue
  5. local infoColor = colors.green
  6.  
  7. -- Clear the screen and set background color
  8. term.setBackgroundColor(bgColor)
  9. term.clear()
  10. term.setCursorPos(1, 1)
  11.  
  12. -- Function to print a header with a background color
  13. local function printHeader(text)
  14. term.setTextColor(headerColor)
  15. term.setBackgroundColor(bgColor)
  16. print(text)
  17. term.setTextColor(textColor)
  18. end
  19.  
  20. -- Function to print info with colors
  21. local function printInfo(label, value)
  22. term.setTextColor(infoColor)
  23. term.write(label .. ": ")
  24. term.setTextColor(textColor)
  25. print(value)
  26. end
  27.  
  28. -- Display ASCII art
  29. term.setTextColor(headerColor)
  30. print(" |\\_/|")
  31. print(" | @ @ DEVICE INFORMATION ")
  32. print(" | <> _ ")
  33. print(" | _/\\------____ ((| |))")
  34. print(" | `--' | ")
  35. print(" ____|_ ___| |___.' ")
  36. print("/_/_____/____/_______|")
  37.  
  38. -- Function to read config file using Lua's loadfile
  39. local function readConfig()
  40. local configFilePath = "/disk/bootloader/system.config"
  41. if fs.exists(configFilePath) then
  42. local config = loadfile(configFilePath)()
  43. if type(config) == "table" then
  44. return config
  45. else
  46. return {} -- Return an empty table if the format is incorrect
  47. end
  48. end
  49. return {} -- Return an empty table if the file does not exist
  50. end
  51.  
  52. -- Function to get the device info
  53. local function getDeviceInfo()
  54. local config = readConfig() -- Read config from Lua file
  55. local id = os.getComputerID() or "Unknown ID"
  56. local label = os.getComputerLabel() or "No Label"
  57. local osVersion = config.os_version or "Unknown OS Version"
  58. local bootloaderVersion = config.bootloader_version or "Unknown Bootloader Version"
  59. local securityPatch = config.security_patch or "Unknown Security Patch"
  60. local recoveryPartition = fs.exists("/recovery/") and "Recovery partition exists" or "No Recovery partition"
  61.  
  62. return {
  63. id = id,
  64. label = label,
  65. osVersion = osVersion,
  66. bootloaderVersion = bootloaderVersion,
  67. securityPatch = securityPatch,
  68. recoveryPartition = recoveryPartition
  69. }
  70. end
  71.  
  72. -- Get device info
  73. local info = getDeviceInfo()
  74.  
  75. -- Display device info with better UI
  76. printHeader("Computer Information:")
  77. printInfo("Computer ID", info.id)
  78. printInfo("Computer Label", info.label)
  79. printHeader("Software Information:")
  80. printInfo("Doggy OS Version", info.osVersion)
  81. printInfo("VA11-ILLA Bootloader Version", info.bootloaderVersion)
  82. printInfo("Security Patch Version", info.securityPatch)
  83. printHeader("System Information:")
  84. printInfo("Recovery Partition Status", info.recoveryPartition)
  85.  
  86. -- Prompt and wait for Enter key to reboot
  87. term.setTextColor(colors.yellow)
  88. term.setTextColor(textColor)
  89. local input = read()
  90. if input == "" then
  91. -- Reboot the computer
  92. os.reboot()
  93. end
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement