From 99b57b321bef2b9a4830729d93155ca758681c8f Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 24 Aug 2024 18:42:05 -0400 Subject: [PATCH] fix: devcontainer utils.sh ssh copy improvements (#3372) fix utils.sh - use HOME variable, permissions and logging Signed-off-by: Dave Lee --- .devcontainer-scripts/utils.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.devcontainer-scripts/utils.sh b/.devcontainer-scripts/utils.sh index 7018c745abe7..98ac063cfdb5 100644 --- a/.devcontainer-scripts/utils.sh +++ b/.devcontainer-scripts/utils.sh @@ -32,19 +32,22 @@ config_remote() { } # Setup special .ssh files -# +# Prints out lines of text to make things pretty # Param 1: bash array, filenames relative to the customization directory that should be copied to ~/.ssh setup_ssh() { - mkdir -p ~/.ssh + echo "starting ~/.ssh directory setup..." + mkdir -p "${HOME}.ssh" + chmod 0700 "${HOME}/.ssh" + echo "-----" local files=("$@") for file in "${files[@]}" ; do local cfile="/devcontainer-customization/${file}" - local hfile="~/.ssh/${file}" + local hfile="${HOME}/.ssh/${file}" if [ ! -f "${hfile}" ]; then - echo "copying ${file}" + echo "copying \"${file}\"" cp "${cfile}" "${hfile}" chmod 600 "${hfile}" fi done - ls ~/.ssh + echo "~/.ssh directory setup complete!" }