From 8a9be3721ea99e99720b5711c4391dc9570c89ea Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 11 Nov 2019 10:54:31 -0800 Subject: [PATCH] Modified intel-gpu-info to not require lspci Signed-off-by: James Ketrenos --- Dockerfile | 5 +---- assets/intel-gpu-info | 22 ++++++++++++++++------ templates/ubuntu/10-default-packages.in | 5 +---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index d768929..5ab87e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,13 +73,10 @@ RUN apt-get -q update \ # # NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from # trying to prompt for configuration details during install. -# -# pciutils is needed for lspci used by assets/intel-gpu-info RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \ locales \ - software-properties-common \ - pciutils + software-properties-common # Set up locales RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 diff --git a/assets/intel-gpu-info b/assets/intel-gpu-info index 7848d18..d1744ce 100755 --- a/assets/intel-gpu-info +++ b/assets/intel-gpu-info @@ -265,14 +265,24 @@ devices+=(0x4551 "ehl_4x4" "Intel(R) HD Graphics (Elkhart Lake 4x4)") devices+=(0x4541 "ehl_2x4" "Intel(R) HD Graphics (Elkhart Lake 2x4)") count=${#devices[*]} found=0 -for id in $(lspci -n | sed -nE 's,^.*8086:([a-f0-9]*).*$,0x\U\1,pg'); do - device=0 - while (( ${device} < ${count} )); do - (( "${devices[$device]}" == "$id" )) && { - echo "${devices[$((device+2))]}" +intel_devices=($({ +find -L /sys/bus/pci/devices -maxdepth 2 -name vendor | + while read vendor; do + [[ "$(cat ${vendor})" == "0x8086" ]] && { + device=$(cat ${vendor/vendor/device}) + echo "${device}" + } + done +} | sort -u)) + +for device in ${intel_devices[@]}; do + index=0 + while (( ${index} < ${count} )); do + (( "${devices[${index}]}" == "${device}" )) && { + echo "${devices[$((index+2))]}" found=1 } - device=$((device+3)) + index=$((index+3)) done done diff --git a/templates/ubuntu/10-default-packages.in b/templates/ubuntu/10-default-packages.in index 5250e6f..2282054 100644 --- a/templates/ubuntu/10-default-packages.in +++ b/templates/ubuntu/10-default-packages.in @@ -4,13 +4,10 @@ # # NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from # trying to prompt for configuration details during install. -# -# pciutils is needed for lspci used by assets/intel-gpu-info RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \ locales \ - software-properties-common \ - pciutils + software-properties-common # Set up locales RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8