Fix error on ubuntu machines

pull/97/head
Ty Fiero 10 months ago
parent d8e575d386
commit 6f6133422c

@ -1,35 +1,38 @@
import os import os
import platform import platform
def get_system_info(): def get_system_info():
system = platform.system() system = platform.system()
if system == "Linux": if system == "Linux":
# Attempt to identify specific Linux distribution # Attempt to identify specific Linux distribution
distro = "linux" # Default to generic 'linux' distro = "linux" # Default to generic 'linux'
try: try:
with open("/etc/os-release") as f: with open("/etc/os-release") as f:
os_release_info = f.read().lower() os_release_info = f.read().lower()
if "ubuntu" in os_release_info: if "raspbian" in os_release_info:
return "raspberry-pi-ubuntu" distro = "raspberry-pi-os"
elif "raspbian" in os_release_info: elif "ubuntu" in os_release_info:
return "raspberry-pi-os" distro = "ubuntu"
except FileNotFoundError: except FileNotFoundError:
pass pass
# Check for Raspberry Pi hardware # Check for Raspberry Pi hardware
is_raspberry_pi = False
try: try:
with open("/proc/device-tree/model") as f: with open("/proc/device-tree/model") as f:
model_info = f.read() model_info = f.read()
if "Raspberry Pi" in model_info: if "Raspberry Pi" in model_info:
if distro == "ubuntu": is_raspberry_pi = True
return "raspberry-pi-ubuntu"
return "raspberry-pi"
except FileNotFoundError: except FileNotFoundError:
pass pass
return distro if is_raspberry_pi:
if distro == "ubuntu":
return "raspberry-pi-ubuntu"
else:
return "raspberry-pi"
else:
return distro
elif system == "Darwin": elif system == "Darwin":
return "darwin" return "darwin"
elif system == "Windows": elif system == "Windows":

Loading…
Cancel
Save