Skip to content

Commit

Permalink
Fix wrong logic to check existence of .ssh dir
Browse files Browse the repository at this point in the history
The current logic assumes $HOME/.ssh is a file but it should be
a directory.

This also simplifies the selinux relabeling using restorecon because
the context explicitly defined is the default one.
  • Loading branch information
kajinamit committed Aug 22, 2023
1 parent 8655d7b commit 5ed91fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devsetup/scripts/gen-edpm-compute-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ if [ ! -f ${SSH_PUBLIC_KEY} ]; then
exit 1
fi

if test -f "${HOME}/.ssh"; then
if [ ! -d "${HOME}/.ssh" ]; then
mkdir "${HOME}/.ssh"
chmod 700 "${HOME}/.ssh"
chcon unconfined_u:object_r:ssh_home_t:s0 "${HOME}/.ssh"
restorecon -R "${HOME}/.ssh"
fi

cat <<EOF >${OUTPUT_DIR}/${EDPM_COMPUTE_NAME}.xml
Expand Down

0 comments on commit 5ed91fa

Please sign in to comment.