Ajout : fonctions pour manipuler des images disque dans qemush

This commit is contained in:
Hippolyte Chauvin 2023-10-15 12:08:45 +02:00
parent 7db32e1bbf
commit c115dbd144

View file

@ -23,11 +23,14 @@ public_help() {
name="$(basename "$0")"
cat << EOF
${name}: usage:
${name} start <VM name> - start a VM
${name} watch <VM name> - attach VM screen session
${name} active - (default behaviour) list active VMs
${name} list - list available VMs
${name} help - show this help
${name} start <VM name> - start a VM
${name} watch <VM name> - attach VM screen session
${name} active - (default behaviour) list active VMs
${name} list - list available VMs
${name} help - show this help
${name} diskls - list available disk images
${name} diskadd <disk name> <size> - create a disk image
${name} diskrm <disk name> - delete disk image
EOF
}
@ -57,6 +60,23 @@ public_list() {
ls --color=auto bin
}
diskpath() {
printf 'images/%s.qcow2' "$1"
}
public_diskadd() {
qemu-img create -f qcow2 "$(diskpath "$1")" "$2"
}
public_diskrm() {
rm -vi -- "$(diskpath "$1")"
}
public_diskls() {
echo "Available disks:"
ls --color=auto images
}
function="$1"
shift