vm*.txt move
This commit is contained in:
parent
65ef7afb4a
commit
155b19e1a7
|
@ -8,7 +8,7 @@ IPV6_PREFIX="2a03:6000:9210"
|
||||||
IPV6_START=9200
|
IPV6_START=9200
|
||||||
MAC_PREFIX="fe:e1:bb:d4:c3"
|
MAC_PREFIX="fe:e1:bb:d4:c3"
|
||||||
# .conf locations
|
# .conf locations
|
||||||
VMS="."
|
VMS="/home/mischa/Development/vms/vms"
|
||||||
ETC="."
|
ETC="."
|
||||||
IMAGES="."
|
IMAGES="."
|
||||||
HTDOCS="."
|
HTDOCS="."
|
||||||
|
|
|
@ -37,6 +37,7 @@ main () {
|
||||||
|
|
||||||
date=$(date "+%Y-%m-%d %H:%M:%S")
|
date=$(date "+%Y-%m-%d %H:%M:%S")
|
||||||
echo "New config files created for $SERVER @ $date"
|
echo "New config files created for $SERVER @ $date"
|
||||||
|
echo "VM definition files in: $VMS"
|
||||||
|
|
||||||
fs=$(
|
fs=$(
|
||||||
list_files "$VMS"
|
list_files "$VMS"
|
||||||
|
@ -73,7 +74,7 @@ find_vm() {
|
||||||
# Find the number of the VM (VM#).
|
# Find the number of the VM (VM#).
|
||||||
# Takes the directory with vm*.txt files and instance
|
# Takes the directory with vm*.txt files and instance
|
||||||
# Checks if instance exists otherwise returns the vm filename
|
# 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$//'
|
then echo "$_vm" | sed 's/^\.\/vm//;s/\.txt$//'
|
||||||
else echo "$2" | sed 's/^vm//'
|
else echo "$2" | sed 's/^vm//'
|
||||||
fi
|
fi
|
||||||
|
@ -118,7 +119,7 @@ check_instance() {
|
||||||
# Takes vm*.txt and instance
|
# Takes vm*.txt and instance
|
||||||
# prints either filename or instance variable
|
# prints either filename or instance variable
|
||||||
if test -z "$2"
|
if test -z "$2"
|
||||||
then echo "$1" | sed 's/^\.\///;s/\.txt$//'
|
then echo "$1" | sed "s@^$VMS@@;s@^/@@;s/\\.txt$//"
|
||||||
else echo "$2"
|
else echo "$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -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!!"
|
|
@ -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!!"
|
Loading…
Reference in New Issue