From a17c1908df74517b81021fb986b061f4bbc8d167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 22 Sep 2020 15:04:47 +0200 Subject: [PATCH] More symlinks to fix LDAP, Centrify, SSSD Also added a -f to the rm command for non-existing files. --- scripts/prefix-symlink-host-paths.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/prefix-symlink-host-paths.sh b/scripts/prefix-symlink-host-paths.sh index f6966e2c..99f9ab4d 100755 --- a/scripts/prefix-symlink-host-paths.sh +++ b/scripts/prefix-symlink-host-paths.sh @@ -23,15 +23,23 @@ if [[ $EPREFIX != $EXPECTED_START/* ]]; then exit 1 fi -# /etc/passwd: required to ensure local users are known (see https://github.com/EESSI/compatibility-layer/issues/15) -# /etc/group: required to ensure local user groups are known -for path in /etc/passwd /etc/group; do +paths=( + "/etc/passwd" # required to ensure local users are known (see https://github.com/EESSI/compatibility-layer/issues/15) + "/etc/group" # required to ensure local user groups are known + "/etc/nsswitch.conf" # required to ensure name-service information is taken from the right source (e.g. ldap) + "/etc/resolv.conf" # required to use the DNS resolver from the host (should be done automatically) + "/lib64/libnss_centrifydc.so.2" # required if Centrify is used in nsswitch.conf + "/lib64/libnss_ldap.so.2" # required if LDAP is used in nsswitch.conf + "/lib64/libnss_sss.so.2" # required if SSSD is used in nsswitch.conf +) + +for path in ${paths[@]}; do echo ">> checking $path ..." ls -ld ${EPREFIX}$path | grep " -> $path" > /dev/null ec=$? if [ $ec -ne 0 ]; then echo_yellow ">> [CHANGE] ${EPREFIX}$path is *not* a symlink to $path, fixing that..." - rm ${EPREFIX}$path + rm -f ${EPREFIX}$path ln -s $path ${EPREFIX}$path else echo_green ">> [OK] ${EPREFIX}$path is already a symlink to $path"