Update vmcreate1.sh

This commit is contained in:
2025-10-26 16:57:57 +00:00
parent 49d9eae97d
commit 61f866c255

View File

@@ -149,8 +149,8 @@ if [[ $# -ne 0 && -v "$file" ]]; then
fi
# Проверка файла на соответствие шаблону IPv4 адреса и hostname, создаём временный файл из валидных строк
echo "DEBUG file: $file"
if [[ $# -eq 0 && -e "$file" ]]; then
echo "DEBUG file: $file"
touch hosts.tmp
echo -n "" > hosts.tmp
echo "DEBUG"
@@ -178,6 +178,7 @@ fi
# Если заданы аргументы, то создаем временный файл
if [[ $# -ne 0 ]]; then
echo "DEBUG using arguments"
touch hosts.tmp
echo -n "" > hosts.tmp
for arg in "$@"; do
@@ -196,8 +197,7 @@ if [[ $# -ne 0 ]]; then
fi
# Проверяем ключ
if [ -v $pubkey ]; then
if [[ ! -e "$pubkey" ]]; then
if [[ ! -e "$pubkey" ]]; then
input=y
echo "Public key does not exist. Generate new pair? y/n"
read input
@@ -208,10 +208,6 @@ if [ -v $pubkey ]; then
N) echo "Public key is necessary to continue. Please specify or generate new pair."; exit 6;;
*) echo "Use '-h' flag for help"; exit 6;;
esac
fi
else
pubkey="key.pub"
if [[ ! -e key.pub ]]; then echo "key.pub does not exist. Please use '-k' flag to specify public key."; exit 7; fi
fi
###DEBUG 1