dotfiles/bin/virt-manager-launcher
2021-09-21 17:11:57 +02:00

19 lines
346 B
Bash
Executable File

#!/usr/bin/bash
if [ "$EUID" != '0' ]; then
echo 'error: you cannot perform this operation unless you are root.'
exit 1
fi
systemctl start libvirtd
virsh net-start default
if [ -n "$SUDO_USER" ]; then
su "$SUDO_USER" -c 'virt-manager --no-fork'
else
virt-manager --no-fork
fi
virsh net-destroy default
systemctl stop libvirtd