2020-04-25 04:32:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
|
2020-10-04 00:25:26 +00:00
|
|
|
echo "Beginning of teardown!"
|
|
|
|
|
2020-12-22 03:14:44 +00:00
|
|
|
# Restart Display Manager
|
|
|
|
input="/tmp/vfio-store-display-manager"
|
|
|
|
while read displayManager; do
|
|
|
|
if command -v systemctl; then
|
|
|
|
systemctl start "$displayManager.service"
|
|
|
|
else
|
|
|
|
if command -v sv; then
|
|
|
|
sv start $displayManager
|
|
|
|
fi
|
|
|
|
fi
|
2020-10-09 00:30:22 +00:00
|
|
|
done < "$input"
|
2020-04-25 04:32:07 +00:00
|
|
|
|
2020-10-09 00:30:22 +00:00
|
|
|
# Rebind VT consoles (adapted from https://www.kernel.org/doc/Documentation/fb/fbcon.txt)
|
|
|
|
input="/tmp/vfio-bound-consoles"
|
|
|
|
while read consoleNumber; do
|
|
|
|
if test -x /sys/class/vtconsole/vtcon${consoleNumber}; then
|
|
|
|
if [ `cat /sys/class/vtconsole/vtcon${consoleNumber}/name | grep -c "frame buffer"` \
|
|
|
|
= 1 ]; then
|
|
|
|
echo "Rebinding console ${consoleNumber}"
|
|
|
|
echo 1 > /sys/class/vtconsole/vtcon${consoleNumber}/bind
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done < "$input"
|
2020-10-04 00:25:26 +00:00
|
|
|
|
2020-12-22 03:14:44 +00:00
|
|
|
# Rebind framebuffer for nvidia
|
|
|
|
if test -e "/tmp/vfio-is-nvidia" ; then
|
|
|
|
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
|
2020-10-04 00:25:26 +00:00
|
|
|
fi
|
2020-04-25 04:32:07 +00:00
|
|
|
|
2020-10-04 00:25:26 +00:00
|
|
|
echo "End of teardown!"
|