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
This commit is contained in:
nott 2007-12-03 13:21:42 +00:00
parent 6408b3d1c7
commit 82a723194a

View File

@ -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 -