From 82a723194a085cce553930be6fe57c57efb39228 Mon Sep 17 00:00:00 2001 From: nott Date: Mon, 3 Dec 2007 13:21:42 +0000 Subject: [PATCH] Modify this script so it will run on AIX. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@116 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/scripts/setup-local-client.sh | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) 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 -