mirror of
https://github.com/foxlet/macOS-Simple-KVM.git
synced 2024-11-30 06:59:42 +01:00
[TOOLS] virsh XML generator.
This commit is contained in:
parent
091ebfddab
commit
985beaa815
1 changed files with 37 additions and 0 deletions
37
make.sh
Executable file
37
make.sh
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# make.sh: Generate customized libvirt XML.
|
||||||
|
# by Foxlet <foxlet@furcode.co>
|
||||||
|
|
||||||
|
VMDIR=$PWD
|
||||||
|
OUT="template.xml"
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
echo
|
||||||
|
echo "Usage: $0"
|
||||||
|
echo
|
||||||
|
echo " -a, --add Add XML to virsh (uses sudo)."
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
local error_message="$@"
|
||||||
|
echo "${error_message}" 1>&2;
|
||||||
|
}
|
||||||
|
|
||||||
|
generate(){
|
||||||
|
sed -e "s|VMDIR|$VMDIR|g" tools/template.xml.in > $OUT
|
||||||
|
echo "$OUT has been generated in $VMDIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate
|
||||||
|
|
||||||
|
argument="$1"
|
||||||
|
case $argument in
|
||||||
|
-a|--add)
|
||||||
|
sudo virsh define $OUT
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in a new issue