31 lines
No EOL
1 KiB
Bash
31 lines
No EOL
1 KiB
Bash
#!/bin/bash
|
|
|
|
function create_volume {
|
|
[[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://git.g3e.fr/H6N/tools/raw/branch/main/libs/shflags)"
|
|
|
|
DEFINE_string 'volume_name' '-' 'Volume Name' 'v'
|
|
DEFINE_string 'backind_volume' '-' 'Volume Back' 'b'
|
|
DEFINE_string 'volume_size' '-' 'Volume Size' 's'
|
|
DEFINE_boolean 'dryrun' false 'Enable dry-run mode' 'd'
|
|
|
|
FLAGS "$@" || exit $?
|
|
eval set -- "${FLAGS_ARGV}"
|
|
|
|
qemu-img create \
|
|
-f qcow2 -b "${FLAGS_backind_volume}" \
|
|
-F qcow2 "${FLAGS_volume_name}" \
|
|
"${FLAGS_volume_size}"
|
|
}
|
|
|
|
function delete_volume {
|
|
[[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://git.g3e.fr/H6N/tools/raw/branch/main/libs/shflags)"
|
|
|
|
DEFINE_string 'volume_name' '-' 'Volume Name' 'v'
|
|
DEFINE_boolean 'dryrun' false 'Enable dry-run mode' 'd'
|
|
|
|
FLAGS "$@" || exit $?
|
|
eval set -- "${FLAGS_ARGV}"
|
|
|
|
rm -rf "${FLAGS_backind_volume}"
|
|
|
|
} |