Add virtxp script

This commit is contained in:
Anthony Rose 2023-04-08 21:03:10 +01:00
parent b0f0de7d74
commit 86b7b4f593
2 changed files with 36 additions and 0 deletions

31
roles/home-cli/files/virtxp.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
_acp_vm_root="$HOME/virt/images"
_acp_vm_session=qemu:///session
_acp_vm_name=${1:---help}
case "$_acp_vm_name" in
"--help" | -*)
echo "Usage: virtinst vmname --cdrom install.iso [other virt-install options]" >&2
exit 1
;;
*)
;;
esac
# Create the directory if it doesn't exist already.
if ! [ -d "$_acp_vm_root" ]
then
mkdir -p "$_acp_vm_root"
fi
virt-install --connect $_acp_vm_session \
--osinfo winxp \
--cpu host-passthrough \
--disk "$_acp_vm_root/$_acp_vm_name.qcow2,size=20" \
--graphics vnc \
--console pty,target.type=virtio \
--channel unix,target.type=virtio,target.name=org.qemu.guest_agent.0 \
--video qxl \
--autoconsole none \
--network none \
--name "$@"

View file

@ -71,6 +71,11 @@
src: virtinst.sh src: virtinst.sh
dest: "{{ ansible_env.HOME }}/.local/bin/virtinst" dest: "{{ ansible_env.HOME }}/.local/bin/virtinst"
mode: '0755' mode: '0755'
- name: Create $HOME/.local/bin/virtxp
ansible.builtin.copy:
src: virtxp.sh
dest: "{{ ansible_env.HOME }}/.local/bin/virtxp"
mode: '0755'
- name: Create $XDG_CONFIG_HOME/user-dirs.dirs - name: Create $XDG_CONFIG_HOME/user-dirs.dirs
ansible.builtin.copy: ansible.builtin.copy:
src: user-dirs.dirs src: user-dirs.dirs