configura.sh: la chiave in ~/.ssh/config si scrive con ~

Su Windows Git Bash il percorso intero diventa /c/Users/..., che l'OpenSSH
di Windows (quello usato da VS Code) non capisce. Con ~ vanno bene tutti e due,
e anche il Mac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fabio
2026-09-30 20:51:31 +02:00
co-authored by Claude Opus 5.5
parent 72f6ac0d5f
commit daec6ab3c2
+4 -1
View File
@@ -146,6 +146,9 @@ FINE_BLOCCO="# <<< OTO <<<"
# Confronto esatto, non una regex: il segno contiene "/" e "(". # Confronto esatto, non una regex: il segno contiene "/" e "(".
FUORI="$(awk -v i="$INIZIO" -v f="$FINE_BLOCCO" '$0 == i {dentro=1; next} $0 == f {dentro=0; next} !dentro' "$CONFIG")" FUORI="$(awk -v i="$INIZIO" -v f="$FINE_BLOCCO" '$0 == i {dentro=1; next} $0 == f {dentro=0; next} !dentro' "$CONFIG")"
# La chiave con ~ e non col percorso intero: su Windows Git Bash scriverebbe
# /c/Users/..., che l'OpenSSH di Windows (quello di VS Code) non capisce.
CHIAVE_CONFIG="~${CHIAVE_SSH#"$HOME"}"
BLOCCO="$INIZIO" BLOCCO="$INIZIO"
for VOCE in "$STAGING_NOME $STAGING_HOST" "$PRODUZIONE_NOME $PRODUZIONE_HOST" ; do for VOCE in "$STAGING_NOME $STAGING_HOST" "$PRODUZIONE_NOME $PRODUZIONE_HOST" ; do
set -- $VOCE set -- $VOCE
@@ -158,7 +161,7 @@ Host $1
HostName $2 HostName $2
User $UTENTE_SERVER User $UTENTE_SERVER
IdentitiesOnly yes IdentitiesOnly yes
IdentityFile $CHIAVE_SSH IdentityFile $CHIAVE_CONFIG
" "
done done
BLOCCO="$BLOCCO$FINE_BLOCCO" BLOCCO="$BLOCCO$FINE_BLOCCO"