From 0a720847f45f40ad3c25f5d0093cb0eed9e54338 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 29 Apr 2025 21:03:52 +0200 Subject: [PATCH] Fix. --- testing/scripts/init_server_access.sh | 16 ++++++++++++++-- testing/scripts/pull_catgirl_logs.sh | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/testing/scripts/init_server_access.sh b/testing/scripts/init_server_access.sh index 08aefd0..7c470ad 100755 --- a/testing/scripts/init_server_access.sh +++ b/testing/scripts/init_server_access.sh @@ -1,6 +1,7 @@ #!/bin/sh set -e cd $(dirname "$0") +. lib/abort_if_command_unknown . lib/constants_ssh # PATH_USER_SSH . lib/expect_n_args . lib/path_tmp_timestamped @@ -9,8 +10,13 @@ cd $(dirname "$0") PATH_KNOWN_HOSTS="${PATH_USER_SSH}/known_hosts" URL_REPO_CLONE='https://plomlompom.com/repos/clone/config' -expect_n_args 1 1 '(server)' $@ +expect_n_args 1 2 'SERVER [ROOT_LOGIN_PW]' $@ SERVER="$1" +ROOT_LOGIN_PW="$2" +if [ ! -z "${ROOT_LOGIN_PW}" ]; then + echo '· Provided ROOT_LOGIN_PW, so will later try to log-in with that and place local key file …' + abort_if_command_unknown sshpass +fi echo "· In ${PATH_KNOWN_HOSTS}, removing previous entry for ${SERVER} if found …" ssh-keygen -f "${PATH_KNOWN_HOSTS}" -R "${SERVER}" > /dev/null @@ -31,7 +37,13 @@ fi ${CMD_RM_LOG} trapp -CMD_SSH="ssh root@${SERVER}" +SSH_TARGET="root@${SERVER}" +if [ ! -z "${ROOT_LOGIN_PW}" ]; then + echo '· Logging in with provided password to place local key file …' + SSHPASS="${ROOT_LOGIN_PW}" sshpass -e scp "${PATH_USER_SSH}/id_rsa.pub" "root@${SERVER}:~/${PATH_REL_SSH}/authorized_keys" +fi + +CMD_SSH="ssh ${SSH_TARGET}" CMD_STTY_ECHO='stty echo' echo '· On server, asking for new root password …' diff --git a/testing/scripts/pull_catgirl_logs.sh b/testing/scripts/pull_catgirl_logs.sh index c13676e..323b6ae 100755 --- a/testing/scripts/pull_catgirl_logs.sh +++ b/testing/scripts/pull_catgirl_logs.sh @@ -3,12 +3,13 @@ set -e cd $(dirname "$0") . lib/abort_if_command_unknown . lib/abort_if_offline +. lib/constants_ssh # PATH_USER_SSH . lib/expect_n_args . lib/path_tmp_timestamped . lib/trapp PATH_LOGS_LOCAL="${HOME}/chatlogs/catgirl" -PATH_DECRYPTION_KEY_ENCRYPTED="${HOME}/.ssh/id_rsa" +PATH_DECRYPTION_KEY_ENCRYPTED="${PATH_USER_SSH}/id_rsa" DIRNAME_ENCRYPTED_REMOTE='logs_encrypted' abort_if_offline -- 2.30.2