From c57cd85ca45e35692443bf22f53cbe0e5deb1280 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Fri, 30 Jun 2023 20:09:34 +0100 Subject: [PATCH] Work for root and upgrade osinfo --- roles/home-cli/files/virtinst.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/roles/home-cli/files/virtinst.sh b/roles/home-cli/files/virtinst.sh index af7656f..b7c0516 100755 --- a/roles/home-cli/files/virtinst.sh +++ b/roles/home-cli/files/virtinst.sh @@ -1,6 +1,12 @@ #!/bin/sh -_acp_vm_root="$HOME/virt/images" -_acp_vm_session=qemu:///session +if [ $(id -u) -eq 0 ] +then + _acp_vm_root=/srv/virt/images + _acp_vm_session=qemu:///system +else + _acp_vm_root="$HOME/virt/images" + _acp_vm_session=qemu:///session +fi _acp_vm_name=${1:---help} case "$_acp_vm_name" in @@ -18,8 +24,10 @@ then mkdir -p "$_acp_vm_root" fi +# To get a list of valid osinfo options, run: +# virt-install --osinfo list virt-install --connect $_acp_vm_session \ - --osinfo linux2020 \ + --osinfo linux2022 \ --boot uefi \ --cpu host-passthrough \ --disk "$_acp_vm_root/$_acp_vm_name.qcow2,size=20" \