From 509048c54cdb719135601ed5c25c8ad222439517 Mon Sep 17 00:00:00 2001 From: askiiart Date: Wed, 6 Sep 2023 15:21:33 -0500 Subject: [PATCH] Add qemu install script --- qemu-install.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 qemu-install.sh diff --git a/qemu-install.sh b/qemu-install.sh new file mode 100644 index 0000000..130c6ba --- /dev/null +++ b/qemu-install.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -e +if [ $(whoami) == "root" ]; then + echo "Run as a normal user, not root" + exit 1 +fi + +command_exists() { type "$1" &>/dev/null; } + +if command_exists "apt-get"; then + sudo apt-get install qemu-system libvirt-daemon-system virt-manager -y +elif command_exists "yum"; then + sudo yum install @Virtualization virt-manager -y +elif command_exists "pacman"; then + sudo pacman -S qemu-full --noconfirm + sudo pacman -S virt-manager --noconfirm +elif command_exists "zypp"; then + # Untested + sudo zypper install qemu -y +elif command_exists "emerge"; then + sudo echo Not yet supported, exiting... +elif command_exists "apk"; then + sudo apk add qemu-img qemu-system-x86_64 libvirt-daemon py-libvirt py-libxml2 + sudo apk add git + sudo rc-update add libvirtd + sudo rc-service libvirtd start +else + echo "Unsupported: unknown package manager" +fi +