Skip to content

Commit 722e32c

Browse files
committed
Avoid using lspci in qubes-gui-agent-pre.sh
It isn't installed in some templates by default. Fortunately, it's quite easy to find the device by simply exploring sysfs.
1 parent b921bf8 commit 722e32c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

appvm-scripts/usr/lib/qubes/qubes-gui-agent-pre.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ echo "GUI_OPTS=$gui_opts" >> /var/run/qubes-service-environment
3131
echo 1073741824 > /sys/module/xen_gntalloc/parameters/limit
3232

3333
# unbind Xen VGA adapter from bochs
34-
vga_adapter=$(lspci -nD | grep "1234:1111" | awk '{print $1}')
35-
if [ -n "$vga_adapter" ] && [ -e /sys/bus/pci/drivers/bochs-drm/unbind ]; then
36-
echo "$vga_adapter" > /sys/bus/pci/drivers/bochs-drm/unbind
34+
driver=/sys/bus/pci/drivers/bochs-drm
35+
if [ -e "$driver" ]; then
36+
for dev in "$driver"/0000:*; do
37+
[ -e "$dev" ] || continue
38+
if [ "$(cat "$dev/vendor"):$(cat "$dev/device")" = "0x1234:0x1111" ]; then
39+
echo "${dev##*/}" > "$driver/unbind"
40+
fi
41+
done
3742
fi

0 commit comments

Comments
 (0)