Update vmcreate1.sh

This commit is contained in:
2025-10-26 15:53:06 +00:00
parent 65762f7332
commit e209da172e

View File

@@ -156,8 +156,8 @@ if [[ $# -eq 0 && -e "$file" ]]; then
cat "$file"
for line in $(cat "$file"); do
echo "DEBUG line:$line"
ip=$(echo -n $line | cut -d ' ' -f 1)
hostname=$(echo -n $line | cut -d ' ' -f 2)
ip=$(echo -n $line | cut -d ';' -f 1)
hostname=$(echo -n $line | cut -d ';' -f 2)
if [[ $? -eq 0 ]]; then
hostcheck "$hostname"
if [[ $? -eq 0 ]]; then
@@ -182,7 +182,7 @@ if [[ $# -ne 0 ]]; then
for arg in "$@"; do
ipcheck "$arg"
if [ $? -eq 0 ]; then
echo -n "$arg " >> ./hosts.tmp
echo -n "$arg;" >> ./hosts.tmp
echo -n "vm" >> ./hosts.tmp
get_vmid "$arg" >> hosts.tmp
echo >> hosts.tmp
@@ -220,7 +220,7 @@ cat hosts.tmp; echo
for line in $(cat hosts.tmp)
do
ip=$(echo -n $line | cut -d ' ' -f 1)
ip=$(echo -n $line | cut -d ';' -f 1)
vlan=$(echo -n $ip | cut -d '.' -f 3)
if [[ $vlan -eq 0 ]]; then
mask=23
@@ -230,7 +230,7 @@ do
mask=24
gw="10.10.${vlan}.1"
fi
hostname=$(echo -n $line | cut -d ' ' -f 2)
hostname=$(echo -n $line | cut -d ';' -f 2)
vmid=$(get_vmid "$ip")
mksnippet
#### DEBUG 2