Skip to content

Commit 48e0bff

Browse files
committed
Improved distro detection
1 parent 7203d55 commit 48e0bff

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

scripts/common/system-info.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,10 @@ function is_distro_immutable() {
606606
# Distribution
607607
KERNEL_VERSION=$(uname -r)
608608

609-
if [ -f "${ROOT_ETC}/os-release" ]; then
609+
if [ -f "${ROOT_ETC}/rpi-issue" ]; then
610+
OS='Raspberry Pi OS'
611+
DISTRO='Raspberry Pi OS'
612+
elif [ -f "${ROOT_ETC}/os-release" ]; then
610613
OS=$(grep "^NAME" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/\"//g')
611614
DISTRO=$(grep "^ID" "${ROOT_ETC}/os-release" | tail -n 1 | awk -F'=' '{print $2}' | sed 's/\"//g')
612615
else
@@ -618,7 +621,6 @@ else
618621
-e 's/-[a-z0-9]*$//g')
619622
fi
620623

621-
622624
if does_bin_exist 'uname'; then
623625
[ -z "${OS}" ] && OS=$(uname -s)
624626
uname -r | grep -q "valve.*neptune" && DISTRO="SteamOS"
@@ -630,16 +632,20 @@ if [ "${DISTRO}" = "arch" ] \
630632
DISTRO_FAMILY='Arch'
631633
OS='Linux'
632634
elif [ "${DISTRO}" = "debian" ]; then
633-
DISTRO="Debian"
634-
DISTRO_FAMILY="Debian"
635+
DISTRO='Debian'
636+
DISTRO_FAMILY='Debian'
637+
OS='Linux'
635638
elif [ "${DISTRO}" = "lineageos" ] || [ $(uname -a | grep -c "Android") -ge 1 ]; then
636-
DISTRO="LineageOS"
637-
DISTRO_FAMILY="Android"
638-
OS="Android"
639+
DISTRO='LineageOS'
640+
DISTRO_FAMILY='Android'
641+
OS='Android'
642+
elif [ "${DISTRO}" = 'Raspberry Pi OS' ]; then
643+
DISTRO_FAMILY='Debian'
644+
OS='Linux'
639645
elif [ "${DISTRO}" = "SteamOS" ]; then
640-
DISTR_FAMILY="Arch"
641-
OS="Linux"
642-
DEVICE_MODEL="Steam Deck"
646+
DISTRO_FAMILY='Arch'
647+
OS='Linux'
648+
DEVICE_MODEL='Steam Deck'
643649
fi
644650

645651
if [ "${OS}" = 'Alpine Linux' ] \
@@ -663,7 +669,7 @@ elif [ "${OS}" = 'postmarketOS' ]; then
663669
DISTRO='postmarketOS'
664670
fi
665671

666-
does_bin_exist 'uname' && uname -r | grep -q "Microsoft" && DISTRO="${DISTRO} WSL"
672+
does_bin_exist 'uname' && uname -r | grep -q 'Microsoft' && DISTRO="${DISTRO} WSL"
667673

668674
# Destkp Environment
669675
if [ -f "${ROOT_USR_BIN}/gnome-session" ]; then

0 commit comments

Comments
 (0)