Skip to content

Commit 1dbef43

Browse files
committed
Improved Distro/OS detection
1 parent c059c97 commit 1dbef43

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

scripts/common/system-info.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,9 @@ if [ -f "${ROOT_ETC}/rpi-issue" ]; then
610610
OS='Raspberry Pi OS'
611611
DISTRO='Raspberry Pi OS'
612612
elif [ -f "${ROOT_ETC}/os-release" ]; then
613-
OS=$(grep "^PRETTY_NAME" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/\"//g')
613+
OS=$(grep "^PRETTY_NAME" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/LTS//g' | sed 's/\s*$//g' | sed 's/\"//g')
614614
[ -z "${OS}" ] && OS=$(grep "^NAME" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/\"//g')
615-
DISTRO=$(grep "^ID" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/\"//g')
615+
DISTRO=$(grep "^ID=" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/\"//g')
616616
else
617617
DISTRO=$(echo "${KERNEL_VERSION}" | sed \
618618
-e 's/^[^-]*-//g' \
@@ -643,10 +643,15 @@ elif [ "${DISTRO}" = "lineageos" ] || [ $(uname -a | grep -c "Android") -ge 1 ];
643643
elif [ "${DISTRO}" = 'Raspberry Pi OS' ]; then
644644
DISTRO_FAMILY='Debian'
645645
OS='Linux'
646-
elif [ "${DISTRO}" = "SteamOS" ]; then
646+
elif [ "${DISTRO}" = 'SteamOS' ]; then
647647
DISTRO_FAMILY='Arch'
648648
OS='Linux'
649649
DEVICE_MODEL='Steam Deck'
650+
elif [ "${DISTRO}" = 'ubuntu' ] \
651+
|| [ "${DISTRO}" = 'Ubuntu' ]; then
652+
DISTRO='Ubuntu'
653+
DISTRO_FAMILY='Ubuntu'
654+
OS='Linux'
650655
fi
651656

652657
if [ "${OS}" = 'Alpine Linux' ] \

0 commit comments

Comments
 (0)