Skip to content

Commit 45cfc9c

Browse files
committed
linux: Log missing /etc/os-release file
1 parent 92547fd commit 45cfc9c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

checks/linux.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ def checkDistro(lines):
5151
distro = isDistroNix[0].split()
5252
distro = distro[2:]
5353
distro = ' '.join(distro)
54+
distroHelp = ''
5455

55-
return [LEVEL_INFO, distro, ""]
56+
# this is logged when the file can't be found at all
57+
if distro == 'Missing /etc/os-release !':
58+
distro = '(Missing)'
59+
distroHelp = 'No distribution detected. This can lead to undefined behaviour. Please consult your distribution\'s support channels on how to fix this.<br>'
60+
61+
return [LEVEL_INFO, distro, distroHelp]
5662

5763

5864
def checkFlatpak(lines):
@@ -178,12 +184,12 @@ def checkLinuxVCam(lines):
178184

179185

180186
def checkLinuxSystemInfo(lines):
181-
if checkFlatpak(lines):
187+
if flatpak := checkFlatpak(lines):
182188
linuxDistroOrFlatpak = 'Flatpak'
183-
linuxSystemInfoHelp = checkFlatpak(lines)[2] + '<br>'
184-
elif checkDistro(lines):
185-
linuxDistroOrFlatpak = 'Distribution: ' + checkDistro(lines)[1]
186-
linuxSystemInfoHelp = ''
189+
linuxSystemInfoHelp = flatpak[2] + '<br>'
190+
elif distro := checkDistro(lines):
191+
linuxDistroOrFlatpak = 'Distribution: ' + distro[1]
192+
linuxSystemInfoHelp = distro[2]
187193
else:
188194
return
189195

0 commit comments

Comments
 (0)