From 97cebd1de7e42ff6c56a6d709318437c093db5a4 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 6 May 2025 09:21:39 +0200 Subject: [PATCH] Fix. --- bookworm/scripts/setup_server.sh | 2 +- testing/aptmark/minimal_desktop | 4 ++++ testing/scripts/init_server_access.sh | 2 +- testing/scripts/pull_catgirl_logs.sh | 16 ++++++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 testing/aptmark/minimal_desktop diff --git a/bookworm/scripts/setup_server.sh b/bookworm/scripts/setup_server.sh index eb3f8a5..4316596 100755 --- a/bookworm/scripts/setup_server.sh +++ b/bookworm/scripts/setup_server.sh @@ -49,7 +49,7 @@ if [ ! -z "${FQDN}" ]; then fi prefixed_msg 'Ensure we have curl and gpg (for caddy installation preparation) …' -apt_get_digested 'install curl gpg' +apt_get_digested '-q -q install curl gpg' PATH_CURL_ERROR="$(path_tmp_timestamped curl_error)" prefixed_msg 'Retrieve caddy repo key …' set +e diff --git a/testing/aptmark/minimal_desktop b/testing/aptmark/minimal_desktop new file mode 100644 index 0000000..591cf69 --- /dev/null +++ b/testing/aptmark/minimal_desktop @@ -0,0 +1,4 @@ +# to avoid booting problems with encrypted LVM, see +cryptsetup-initramfs +lvm2 +# diff --git a/testing/scripts/init_server_access.sh b/testing/scripts/init_server_access.sh index 612cb3f..94219ce 100755 --- a/testing/scripts/init_server_access.sh +++ b/testing/scripts/init_server_access.sh @@ -67,7 +67,7 @@ prefixed_msg 'On server, updating package database …' ${CMD_SSH} 'apt-get -q -q update' prefixed_msg 'On server, installing git …' -${CMD_SSH} 'DEBIAN_FRONTEND=noninteractive apt-get -y install git > /dev/null' +${CMD_SSH} 'DEBIAN_FRONTEND=noninteractive apt-get -y -q -q install git' prefixed_msg 'On server, pulling config repo …' ${CMD_SSH} "git clone -q ${URL_REPO_CLONE}" diff --git a/testing/scripts/pull_catgirl_logs.sh b/testing/scripts/pull_catgirl_logs.sh index 323b6ae..443c793 100755 --- a/testing/scripts/pull_catgirl_logs.sh +++ b/testing/scripts/pull_catgirl_logs.sh @@ -6,8 +6,11 @@ cd $(dirname "$0") . lib/constants_ssh # PATH_USER_SSH . lib/expect_n_args . lib/path_tmp_timestamped +. lib/prefixed_msg . lib/trapp +prefixed_msg_init + PATH_LOGS_LOCAL="${HOME}/chatlogs/catgirl" PATH_DECRYPTION_KEY_ENCRYPTED="${PATH_USER_SSH}/id_rsa" DIRNAME_ENCRYPTED_REMOTE='logs_encrypted' @@ -20,7 +23,7 @@ SERVER="$1" PATH_PROCESSING="$(path_tmp_timestamped pull_catgirl_logs)" RM_PROCESSING="rm -rf ${PATH_PROCESSING}" -echo "Setting up processing directory at ${PATH_PROCESSING} …" +prefixed_msg "Setting up processing directory at ${PATH_PROCESSING} …" mkdir "${PATH_PROCESSING}" trapp "${RM_PROCESSING}" cd "${PATH_PROCESSING}" @@ -29,7 +32,7 @@ cd "${PATH_PROCESSING}" PATH_DECRYPTION_KEY="${PATH_PROCESSING}/key" cp "${PATH_DECRYPTION_KEY_ENCRYPTED}" "${PATH_DECRYPTION_KEY}" # (NB: not using lib/retry_until here cuz ssh-keygen returns non-workable exit codes) -echo -n 'Enter key decryption password: ' +prefixed_msg_no_nl 'Enter key decryption password: ' stty -echo trapp "${RM_PROCESSING}; stty echo" read SSHPASS @@ -38,7 +41,7 @@ trapp "${RM_PROCESSING}" echo '' echo "\n\n" | ssh-keygen -q -P "${SSHPASS}" -p -f "${PATH_DECRYPTION_KEY}" > /dev/null -echo 'Collecting encrypted logs from server …' +prefixed_msg 'Collecting encrypted logs from server …' DIRNAME_TMP_ENCRYPTED="_${DIRNAME_ENCRYPTED_REMOTE}" NAME_ARCHIVE="aged_logs_$(date +'%Y-%m-%d_%H-%M-%S').tar" ssh -q "${SERVER}" "mv ${DIRNAME_ENCRYPTED_REMOTE} ${DIRNAME_TMP_ENCRYPTED} && tar cf ${NAME_ARCHIVE} ${DIRNAME_TMP_ENCRYPTED} && rm -rf ${DIRNAME_TMP_ENCRYPTED}" @@ -47,7 +50,7 @@ ssh -q "${SERVER}" "rm ${NAME_ARCHIVE}" tar xf "${NAME_ARCHIVE}" rm "${NAME_ARCHIVE}" -echo "Decrypting logs to ${PATH_LOGS_LOCAL} …" +prefixed_msg "Decrypting logs to ${PATH_LOGS_LOCAL} …" find "${DIRNAME_TMP_ENCRYPTED}" | while read PATH_FOUND; do if [ ! -f "${PATH_FOUND}" ]; then continue @@ -58,9 +61,10 @@ find "${DIRNAME_TMP_ENCRYPTED}" | while read PATH_FOUND; do SERVERNAME=$(basename $(dirname "${DIRNAME}")) TARGET_DIRNAME="${SERVERNAME}/${CHANNELNAME}" TARGET_DIRPATH="${PATH_LOGS_LOCAL}/${TARGET_DIRNAME}" - echo "Decrypting ${TARGET_DIRNAME}/${TARGET_FILENAME} …" + prefixed_msg "Decrypting ${TARGET_DIRNAME}/${TARGET_FILENAME} …" mkdir -p "${TARGET_DIRPATH}" age --decrypt --identity "${PATH_DECRYPTION_KEY}" "${PATH_FOUND}" >> "${TARGET_DIRPATH}/${TARGET_FILENAME}" done -echo 'Done!' +prefixed_msg 'Done!' +prefixed_msg_exit -- 2.30.2