vm*.txt move

This commit is contained in:
mischa 2018-09-24 23:32:46 +02:00
parent 65ef7afb4a
commit 155b19e1a7
8 changed files with 22 additions and 3 deletions

View File

@ -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="."

View File

@ -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
}

9
vms/vm10.txt Normal file
View File

@ -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!!"

9
vms/vm5.txt Normal file
View File

@ -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!!"