home · contact · privacy
Fix. master
authorChristian Heller <c.heller@plomlompom.de>
Sun, 23 Mar 2025 18:25:52 +0000 (19:25 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 23 Mar 2025 18:25:52 +0000 (19:25 +0100)
testing/scripts/_setup_secrets_user.sh

index 78ffb5bd698356ca31f9c721f03ba2e07887e392..deb31c50f3f340727d26a56b53356ca09a139267 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/sh
 set -e
 cd $(dirname "$0")
 
@@ -30,15 +31,28 @@ echo "\nSetting up ~/.ssh"
 PATH_PUBLIC_KEY="${PATH_PRIVATE_KEY}.pub"
 mkdir -p "${PATH_USER_SSH}"
 cp "${PATH_SECRETS}/${FILENAME_KEY}" "${PATH_PRIVATE_KEY}"
-stty -echo
 while [ ! -s "${PATH_PUBLIC_KEY}" ]; do
+    stty -echo
     set +e
     ssh-keygen -y -f "${PATH_PRIVATE_KEY}" > "${PATH_PUBLIC_KEY}"
     set -e
+    stty echo
 done
 echo ''
-eval $(ssh-agent) && ssh-add
-stty echo
+eval $(ssh-agent)
+while true; do
+    stty -echo
+    set +e
+    ssh-add
+    RESULT=$?
+    set -e
+    stty echo
+    if [ "${RESULT}" = 0 ]; then
+        break
+    elif [ "${RESULT}" != 1 ]; then
+        echo "Aborting due to ssh-add error."
+    fi
+done
 
 echo "\n\nSetting up ~/repos"
 REPOS_SITE_LOGIN="${USERNAME}@${REPOS_SITE_DOMAIN}"