diff --git a/_vms.conf b/_vms.conf index 1cd07da..23d02e4 100644 --- a/_vms.conf +++ b/_vms.conf @@ -8,7 +8,7 @@ IPV6_PREFIX="2a03:6000:9210" IPV6_START=9200 MAC_PREFIX="fe:e1:bb:d4:c3" # .conf locations -VMS="." +VMS="/home/mischa/Development/vms/vms" ETC="." IMAGES="." HTDOCS="." diff --git a/deploy.sh b/deploy.sh index be7da4f..2085814 100755 --- a/deploy.sh +++ b/deploy.sh @@ -37,6 +37,7 @@ main () { date=$(date "+%Y-%m-%d %H:%M:%S") echo "New config files created for $SERVER @ $date" + echo "VM definition files in: $VMS" fs=$( list_files "$VMS" @@ -73,7 +74,7 @@ find_vm() { # Find the number of the VM (VM#). # Takes the directory with vm*.txt files and instance # Checks if instance exists otherwise returns the vm filename - if _vm=$(find "$1" -type f -name "vm*.txt" -maxdepth 1 | xargs grep -l "$2") + if _vm=$(cd "$1" && find . -type f -name "vm*.txt" -maxdepth 1 | xargs grep -l "$2") then echo "$_vm" | sed 's/^\.\/vm//;s/\.txt$//' else echo "$2" | sed 's/^vm//' fi @@ -118,7 +119,7 @@ check_instance() { # Takes vm*.txt and instance # prints either filename or instance variable if test -z "$2" - then echo "$1" | sed 's/^\.\///;s/\.txt$//' + then echo "$1" | sed "s@^$VMS@@;s@^/@@;s/\\.txt$//" else echo "$2" fi } diff --git a/vm1.txt b/vms/vm1.txt similarity index 100% rename from vm1.txt rename to vms/vm1.txt diff --git a/vms/vm10.txt b/vms/vm10.txt new file mode 100644 index 0000000..9e865e5 --- /dev/null +++ b/vms/vm10.txt @@ -0,0 +1,9 @@ +date="2018/09/18" +payment= +donated= +name="User Ten" +email="user.ten@gmail.com" +message="ssh-ed25519 AAAAC3NzaC1lAILmSludIBvFRhkxldn1OEgnQdrNd7PxMQjm2DyYCqHjy super-special-key" +hostname="vmten" +username="userten" +note="This is all awesome!!" diff --git a/vm2.txt b/vms/vm2.txt similarity index 100% rename from vm2.txt rename to vms/vm2.txt diff --git a/vm3.txt b/vms/vm3.txt similarity index 100% rename from vm3.txt rename to vms/vm3.txt diff --git a/vm4.txt b/vms/vm4.txt similarity index 100% rename from vm4.txt rename to vms/vm4.txt diff --git a/vms/vm5.txt b/vms/vm5.txt new file mode 100644 index 0000000..069eabe --- /dev/null +++ b/vms/vm5.txt @@ -0,0 +1,9 @@ +date="2018/09/18" +payment= +donated= +name="User Five" +email="user.five@gmail.com" +message="ssh-ed25519 AAAAC3NzaC1lAILmSludIBvFRhkxldn1OEgnQdrNd7PxMQjm2DyYCqHjy user5" +hostname="vm5" +username="user5" +note="This is all awesome!!"