fix: Check if serial is readable (#232)

This commit is contained in:
Kroese 2025-03-28 20:14:19 +01:00 committed by GitHub
parent 0e5cca6a1e
commit 846c232bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,10 +100,11 @@ else
fi
SM_BIOS=""
PS="/sys/class/dmi/id/product_serial"
if [ -s "/sys/class/dmi/id/product_serial" ]; then
if [ -s "$PS" ] && [ -r "$PS" ]; then
BIOS_SERIAL=$(</sys/class/dmi/id/product_serial)
BIOS_SERIAL=$(<"$PS")
BIOS_SERIAL="${BIOS_SERIAL//[![:alnum:]]/}"
if [ -n "$BIOS_SERIAL" ]; then