More fixes to virtinst

This commit is contained in:
Anthony Rose 2023-01-16 12:16:01 +00:00
parent c2d0078bc4
commit 533ae0799b

View file

@ -379,37 +379,42 @@ tlscheck () {
} }
virtinst () { virtinst () {
_acp_vm_root="$HOME/virt" _acp_vm_root="$HOME/virt/images"
_acp_vm_session=qemu:///session _acp_vm_session=qemu:///session
if [ $# -ne 1 ] if [ "$1" = "--help" ]
then
echo "Usage: virtinst vmname cdrom" >&2
return
fi
if [ $# -ne 2 ]
then then
virtinst --help virtinst --help
return return
fi fi
case "$1" in _acp_vm_name=$1
--help) if [ "$2" = "--import" ]
echo "Usage: virtinst vmname" >&2 then
return _acp_vm_cdrom="--import"
;; else
*) _acp_vm_cdrom="--cdrom $2"
_acp_vm_name=$1 fi
;;
esac
virt-install --connect $_acp_vm_session \ virt-install --connect $_acp_vm_session \
--name $_acp_vm_name \ --name $_acp_vm_name \
--osinfo linux2020 \ --osinfo linux2020 \
--boot uefi \ --boot uefi \
--cdrom $_acp_vm_root/isos/UefiShell.iso \ $_acp_vm_cdrom \
--disk $_acp_vm_root/images/${_acp_vm_name}.qcow2,size=20 \ --disk $_acp_vm_root/${_acp_vm_name}.qcow2,size=20 \
--graphics vnc \ --graphics vnc \
--console pty,target.type=virtio \ --console pty,target.type=virtio \
--autoconsole none --autoconsole none
unset _acp_vm_name unset _acp_vm_name
unset _acp_vm_root unset _acp_vm_root
unset _acp_vm_cdrom
unset _acp_vm_session
} }
if [ -r "$XDG_CONFIG_HOME/profile.local" ] if [ -r "$XDG_CONFIG_HOME/profile.local" ]