Skip to content

Commit

Permalink
fix: devcontainer utils.sh ssh copy improvements (mudler#3372)
Browse files Browse the repository at this point in the history
fix utils.sh - use HOME variable, permissions and logging

Signed-off-by: Dave Lee <[email protected]>
  • Loading branch information
dave-gray101 authored Aug 24, 2024
1 parent 75ef6cc commit 99b57b3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .devcontainer-scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
}

0 comments on commit 99b57b3

Please sign in to comment.