diff --git a/xCAT-server-2.0/share/xcat/scripts/setup-local-client.sh b/xCAT-server-2.0/share/xcat/scripts/setup-local-client.sh index 67b351682..01b8235b2 100755 --- a/xCAT-server-2.0/share/xcat/scripts/setup-local-client.sh +++ b/xCAT-server-2.0/share/xcat/scripts/setup-local-client.sh @@ -1,12 +1,6 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -# not sure about this logic -# - it seems most(or all) of the time when using a socket -# the gettab call will fail since the certificates are -# not ready or have changed? -# - how would the user specify some other XCATDIR? -#XCATDIR=`gettab key=xcatconfdir site.value` if [ -z "$XCATDIR" ]; then XCATDIR=/etc/xcat @@ -15,7 +9,22 @@ if [ -z "$1" ]; then set `whoami` fi CNA="$*" -USERHOME=`getent passwd $1|awk -F: '{print $6}'` + +# getent doesn't exist on AIX +if [ -x getent ];then + USERHOME=`getent passwd $1|awk -F: '{print $6}'` +else + USERHOME=`grep ^$1 /etc/passwd | cut -d: -f6` +fi + +# the home dir for root is "/" on AIX +# - need to avoid "//.xcat" below +# - should probably redo the logic below at some point +if test $USERHOME = / +then + USERHOME= +fi + XCATCADIR=$XCATDIR/ca if [ -e $USERHOME/.xcat ]; then @@ -47,7 +56,7 @@ fi cp root.cert $USERHOME/.xcat/client-cert.pem cp ca-cert.pem $USERHOME/.xcat/ca.pem -chown $1 -R $USERHOME/.xcat +chown -R $1 $USERHOME/.xcat find $USERHOME/.xcat -type f -exec chmod 600 {} \; find $USERHOME/.xcat -type d -exec chmod 700 {} \; cd -