From 5ed91fa7a6e046c011499e710038b88c4d9d60e1 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 23 Aug 2023 00:48:35 +0900 Subject: [PATCH] Fix wrong logic to check existence of .ssh dir 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. --- devsetup/scripts/gen-edpm-compute-node.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devsetup/scripts/gen-edpm-compute-node.sh b/devsetup/scripts/gen-edpm-compute-node.sh index 5f29ae800..53e9814cd 100755 --- a/devsetup/scripts/gen-edpm-compute-node.sh +++ b/devsetup/scripts/gen-edpm-compute-node.sh @@ -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 <${OUTPUT_DIR}/${EDPM_COMPUTE_NAME}.xml