Update create.sh
This commit is contained in:
parent
e6fe4ade83
commit
646031a735
1 changed files with 22 additions and 21 deletions
43
create.sh
43
create.sh
|
|
@ -34,7 +34,7 @@ BRIDGE="vmbr0"
|
|||
MEMORY="4096"
|
||||
CORES="4"
|
||||
STORAGE="btrfs" # Opslaglocatie
|
||||
OSKEUZE="2" # Naam en versie van het besturingssysteem, bijv. "Debian 12"
|
||||
OSKEUZE="5" # Naam en versie van het besturingssysteem, bijv. "Debian 12"
|
||||
TEMPLATE="n" # Of de VM als template moet worden ingesteld (j/n)
|
||||
|
||||
SSH_KEY_TEXT=""
|
||||
|
|
@ -129,10 +129,13 @@ case $OSKEUZE in
|
|||
|
||||
case $SSH_KEYS_PATH in
|
||||
'') # leeg
|
||||
virt-customize -a /tmp/"$IMAGE_NAME" \
|
||||
--run-command 'sed -i "s/^#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config' \
|
||||
--run-command 'sed -i "s/^PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config' \
|
||||
--run-command 'systemctl restart sshd'
|
||||
virt-customize --run-command '
|
||||
CONFIG_FILE="/etc/cloud/cloud.cfg"
|
||||
if ! grep -q "ssh_pwauth" "$CONFIG_FILE"; then
|
||||
echo "ssh_pwauth: true" | sudo tee -a "$CONFIG_FILE" > /dev/null
|
||||
else
|
||||
sudo sed -i "s/^ssh_pwauth false/ssh_pwauth true/" "$CONFIG_FILE"
|
||||
fi' -a /tmp/"$IMAGE_NAME"
|
||||
;;
|
||||
/tmp/temporary_ssh_key.pub) # iets
|
||||
;;
|
||||
|
|
@ -147,10 +150,13 @@ case $OSKEUZE in
|
|||
|
||||
case $SSH_KEYS_PATH in
|
||||
'') # leeg
|
||||
virt-customize -a /tmp/"$IMAGE_NAME" \
|
||||
--run-command 'sed -i "s/^#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config' \
|
||||
--run-command 'sed -i "s/^PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config' \
|
||||
--run-command 'systemctl restart sshd'
|
||||
virt-customize --run-command '
|
||||
CONFIG_FILE="/etc/cloud/cloud.cfg"
|
||||
if ! grep -q "ssh_pwauth" "$CONFIG_FILE"; then
|
||||
echo "ssh_pwauth: true" | sudo tee -a "$CONFIG_FILE" > /dev/null
|
||||
else
|
||||
sudo sed -i "s/^ssh_pwauth false/ssh_pwauth true/" "$CONFIG_FILE"
|
||||
fi' -a /tmp/"$IMAGE_NAME"
|
||||
;;
|
||||
/tmp/temporary_ssh_key.pub) # iets
|
||||
;;
|
||||
|
|
@ -167,10 +173,13 @@ case $OSKEUZE in
|
|||
|
||||
case $SSH_KEYS_PATH in
|
||||
'') # leeg
|
||||
virt-customize -a /tmp/"$IMAGE_NAME" \
|
||||
--run-command 'sed -i "s/^#PasswordAuthentication yes/PasswordAuthentication yes/" /etc/ssh/sshd_config' \
|
||||
--run-command 'sed -i "s/^PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config' \
|
||||
--run-command 'systemctl restart sshd'
|
||||
virt-customize --run-command '
|
||||
CONFIG_FILE="/etc/cloud/cloud.cfg"
|
||||
if ! grep -q "ssh_pwauth" "$CONFIG_FILE"; then
|
||||
echo "ssh_pwauth: true" | sudo tee -a "$CONFIG_FILE" > /dev/null
|
||||
else
|
||||
sudo sed -i "s/^ssh_pwauth false/ssh_pwauth true/" "$CONFIG_FILE"
|
||||
fi' -a /tmp/"$IMAGE_NAME"
|
||||
;;
|
||||
/tmp/temporary_ssh_key.pub) # iets
|
||||
;;
|
||||
|
|
@ -220,14 +229,6 @@ qm set $VMID --ciupgrade 1
|
|||
qm set $VMID --onboot 1
|
||||
[[ -n "$SSH_KEYS_PATH" && -f "$SSH_KEYS_PATH" ]] && qm set $VMID --sshkeys "$SSH_KEYS_PATH"
|
||||
|
||||
#case $SSH_KEYS_PATH in
|
||||
# '') # leeg
|
||||
# ;;
|
||||
# /tmp/temporary_ssh_key.pub) # iets
|
||||
# qm set $VMID --sshkeys /tmp/temporary_ssh_key.pub
|
||||
# ;;
|
||||
#esac
|
||||
|
||||
qm set $VMID --efidisk0 $STORAGE:0,format=raw,pre-enrolled-keys=1
|
||||
|
||||
# Stel de bootvolgorde en disk grootte in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue