File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ ROOT_PROC="${ROOT_PATH}/proc"
5656ROOT_ROOT=" ${ROOT_PATH} /root"
5757ROOT_SRV=" ${ROOT_PATH} /srv"
5858ROOT_SYS=" ${ROOT_PATH} /sys"
59+ ROOT_SYS_BUS=" ${ROOT_SYS} /bus"
60+ ROOT_SYS_BUS_PCI=" ${ROOT_SYS_BUS} /pci"
61+ ROOT_SYS_BUS_PCI_DEVICES=" ${ROOT_SYS_BUS_PCI} /devices"
5962ROOT_SYS_DEVICES=" ${ROOT_SYS} /devices"
6063ROOT_USR=" ${ROOT_PATH} /usr"
6164
@@ -134,6 +137,8 @@ function does_bin_exist() {
134137
135138 if grep -q ' ^/' <<< " ${BINARY_NAME}" \
136139 && does_file_exist " ${BINARY_NAME} " ; then
140+ [ " ${BINARY_NAME} " = ' lspci' ] && [ ! -e " ${ROOT_SYS_BUS_PCI_DEVICES} " ] && return 1 # False
141+
137142 return 0 # True
138143 fi
139144 done
Original file line number Diff line number Diff line change @@ -213,7 +213,8 @@ function get_soc_name() {
213213 fi
214214
215215 if [ -z " ${SOC_MODEL} " ] \
216- && does_bin_exist " lspci" ; then
216+ && [ -f " ${ROOT_SYS_PCI_DEVICES} " ] \
217+ && does_bin_exist ' lspci' ; then
217218 if lspci | grep -q " \sPCI bridge:.*BCM[0-9]\+\s" ; then
218219 SOC_MODEL=$( lspci | \
219220 grep " \sPCI bridge:" | \
@@ -292,7 +293,8 @@ function get_cpu_model() {
292293 fi
293294
294295 if [ -z " ${MODEL} " ] \
295- && does_bin_exist " lspci" ; then
296+ && [ -f " ${ROOT_SYS_PCI_DEVICES} " ] \
297+ && does_bin_exist ' lspci' ; then
296298 if lspci | grep -q " \sPCI bridge:.*BCM[0-9]\+\s" ; then
297299 MODEL=$( lspci | \
298300 grep " \sPCI bridge:" | \
@@ -364,7 +366,8 @@ function get_cpu_family() {
364366 fi
365367
366368 if [ -z " ${VENDOR} " ] \
367- && does_bin_exist " lspci" ; then
369+ && [ -f " ${ROOT_SYS_PCI_DEVICES} " ] \
370+ && does_bin_exist ' lspci' ; then
368371 CPU_LINE=$( lspci | grep " \sPCI bridge:" | head -n 1)
369372 VENDOR=" $( get_cpu_vendor_from_line ${CPU_LINE} ) "
370373 fi
You can’t perform that action at this time.
0 commit comments