2008-09-08 18:54:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
2008-09-09 21:08:48 +00:00
|
|
|
#=head1 otherpkgs
|
2008-09-08 18:54:30 +00:00
|
|
|
#=head2 It gets the extra rpms and install/update them.
|
2008-09-09 21:08:48 +00:00
|
|
|
# The environment variable OTHERPKGS contains the rpms to be installed/updated.
|
2008-09-08 18:54:30 +00:00
|
|
|
# On MN, You need to:
|
2008-09-09 21:08:48 +00:00
|
|
|
# 1. put rpms under /install/post/otherpkgs/os/arch directory where 'os' and 'arch'
|
2008-09-08 18:54:30 +00:00
|
|
|
# can be found in the nodetype table.
|
|
|
|
# 2. put the name of the packages to /opt/xcat/share/xcat/netboot(install)/platform
|
|
|
|
# directory. The file name is one of the following:
|
2008-09-09 21:08:48 +00:00
|
|
|
# profile.os.arch.otherpkgs.pkglist
|
|
|
|
# profile.os.otherpkgs.pkglist
|
|
|
|
# profile.arch.otherpkgs.pkglist
|
|
|
|
# profile.otherpkgs.pkglist
|
2008-09-08 18:54:30 +00:00
|
|
|
# The install/deployment process will pick up the rpms and install them on the nodes.
|
|
|
|
# However, if the nodes have already installed and up and running, you can run the following
|
|
|
|
# command to have the extra rpms installed:
|
2008-09-09 21:08:48 +00:00
|
|
|
# updatenode noderange otherpkgs
|
2008-09-08 18:54:30 +00:00
|
|
|
#
|
|
|
|
#=cut
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2008-09-09 21:08:48 +00:00
|
|
|
#echo "OTHERPKGS=$OTHERPKGS"
|
|
|
|
if [[ -z "$OTHERPKGS" ]]; then
|
2008-09-08 18:54:30 +00:00
|
|
|
echo "$0: no extra rpms to install"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-02-24 21:08:40 +00:00
|
|
|
#if [[ $OSTYPE = linux* ]]; then
|
|
|
|
# #find out the server
|
|
|
|
# SIP=`grep -h dhcp-server-identifier /var/lib/dhclient/dhclient-*.leases|tail -n 1|awk '{print $3}'|sed -e 's/;//'`
|
|
|
|
# if [ -z "$SIP" ]; then
|
|
|
|
# SIP=`grep -h DHCPSID /var/lib/dhcpcd/*.info|awk -F= '{print $2}'|tail -n 1`
|
|
|
|
# fi
|
2009-02-16 07:59:24 +00:00
|
|
|
#update SIP for SLES11
|
2009-02-24 21:08:40 +00:00
|
|
|
#if [ "$OSVER" = "sles11" ]; then
|
|
|
|
# SIP=`echo $SIP |awk -F\' '{print $2}'` #trim '
|
|
|
|
#fi
|
|
|
|
|
2009-03-12 19:44:45 +00:00
|
|
|
if [[ -z "$NFSSERVER" ]]; then
|
|
|
|
NFSSERVER=$MASTER
|
|
|
|
fi
|
2008-09-11 04:43:33 +00:00
|
|
|
|
|
|
|
if [[ $OTHERPKGS_HASREPO -eq 1 ]]; then
|
|
|
|
rpm -q yum
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
#use yum
|
|
|
|
REPOFILE="/tmp/xCAT-otherpkgs.repo"
|
|
|
|
echo "[xcat-otherpkgs]" > $REPOFILE
|
|
|
|
echo "name=xcat-otherpkgs" >> $REPOFILE
|
2009-02-24 21:08:40 +00:00
|
|
|
echo "baseurl=ftp://$NFSSERVER/post/otherpkgs/$OSVER/$ARCH" >> $REPOFILE
|
2008-09-11 04:43:33 +00:00
|
|
|
echo "enabled=1" >> $REPOFILE
|
|
|
|
echo "gpgcheck=0" >> $REPOFILE
|
|
|
|
#clean meta data to make possible for update
|
|
|
|
yum -c $REPOFILE clean metadata
|
|
|
|
|
|
|
|
INSTALLPKGS=""
|
|
|
|
UPDATEPKGS=""
|
|
|
|
#check if the packges are installed already
|
|
|
|
for x in `echo "$OTHERPKGS" | tr "," "\n"`
|
|
|
|
do
|
|
|
|
rpm -q $x
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
UPDATEPKGS="$UPDATEPKGS $x"
|
|
|
|
else
|
|
|
|
INSTALLPKGS="$INSTALLPKGS $x"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
#update packages
|
|
|
|
if [[ ! -z $UPDATEPKGS ]]; then
|
|
|
|
echo "yum -c $REPOFILE -y update $UPDATEPKGS"
|
|
|
|
result=`yum -c $REPOFILE -y update $UPDATEPKGS 2>&1`
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "$result"
|
|
|
|
logger "otherpkgs: $result"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
#install packages
|
|
|
|
if [[ ! -z $INSTALLPKGS ]]; then
|
|
|
|
echo "yum -c $REPOFILE -y install $INSTALLPKGS"
|
|
|
|
result=`yum -c $REPOFILE -y install $INSTALLPKGS 2>&1`
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "$result"
|
|
|
|
logger "otherpkgs: $result"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2009-02-12 10:14:58 +00:00
|
|
|
#try zypper
|
|
|
|
rpm -q zypper
|
|
|
|
if [ $? -eq 0 ]; then
|
2008-09-11 04:43:33 +00:00
|
|
|
#use zypper
|
2009-02-16 12:12:21 +00:00
|
|
|
if [ "$OSVER" = "sles11" ]; then
|
2009-02-24 21:08:40 +00:00
|
|
|
zypper ar ftp://$NFSSERVER/post/otherpkgs/$OSVER/$ARCH/1 otherpkgs
|
2009-02-16 07:59:24 +00:00
|
|
|
else
|
2009-02-24 21:08:40 +00:00
|
|
|
zypper sa ftp://$NFSSERVER/post/otherpkgs/$OSVER/$ARCH/1
|
2009-02-16 07:59:24 +00:00
|
|
|
fi
|
2008-09-11 04:43:33 +00:00
|
|
|
|
|
|
|
#install
|
2009-02-12 10:14:58 +00:00
|
|
|
PKGS=`echo "$OTHERPKGS" | tr "," " "`
|
|
|
|
zypper install -y $PKGS
|
|
|
|
exit 0
|
|
|
|
fi
|
2008-09-11 04:43:33 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
#if it is not handled by the above code, we will use wget to handle it
|
|
|
|
mkdir -p /xcatpost/post/otherpkgs/$OSVER/$ARCH;
|
|
|
|
rm -f -R /xcatpost/post/otherpkgs/*
|
|
|
|
mkdir -p /tmp/postage/
|
|
|
|
rm -f -R /tmp/postage/*
|
|
|
|
cd /tmp/postage
|
|
|
|
|
|
|
|
for x in `echo "$OTHERPKGS" | tr "," "\n"`
|
|
|
|
do
|
2009-02-24 21:08:40 +00:00
|
|
|
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$NFSSERVER/post/otherpkgs/$OSVER/$ARCH/$x-* 2> /tmp/wget.log
|
2008-09-11 04:43:33 +00:00
|
|
|
done
|
|
|
|
|
2009-02-24 21:08:40 +00:00
|
|
|
mv $NFSSERVER/post/otherpkgs/* /xcatpost/post/otherpkgs;
|
|
|
|
rm -rf $NFSSERVER
|
2008-09-11 04:43:33 +00:00
|
|
|
|
|
|
|
cd /xcatpost/post/otherpkgs/$OSVER/$ARCH
|
|
|
|
result=`rpm -Uvh * 2>&1`
|
|
|
|
echo "$result"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
logger "otherpkgs $result"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
else #AIX
|
2008-09-26 23:07:45 +00:00
|
|
|
#mkdir -p /xcatpost/post/otherpkgs/$OSVER/$ARCH
|
|
|
|
#rm -f -R /xcatpost/post/otherpkgs/$OSVER/$ARCH/*
|
2008-09-11 04:43:33 +00:00
|
|
|
|
|
|
|
# get the name of my service node/NIM master from the /etc/niminfo file
|
2008-09-26 23:07:45 +00:00
|
|
|
#if [ -f "/etc/niminfo" ]; then
|
|
|
|
# servnode=`grep NIM_MASTER_HOSTNAME /etc/niminfo|tr "=" " "|awk {'print $3'}`
|
|
|
|
# echo "servnode=$servnode"
|
|
|
|
#else
|
|
|
|
# echo "Could not find /etc/niminfo file"
|
|
|
|
# logger "otherpkgs: Could not find /etc/niminfo file"
|
|
|
|
# exit 1
|
|
|
|
#fi
|
|
|
|
|
|
|
|
#for x in `echo "$OTHERPKGS" | tr "," "\n"`
|
|
|
|
#do
|
|
|
|
# result=`rcp -r $servnode:/install/post/otherpkgs/$OSVER/$ARCH/$x* /xcatpost/post/otherpkgs/$OSVER/$ARCH/.`
|
|
|
|
# if [ $? -ne 0 ]; then
|
|
|
|
# echo "$result"
|
|
|
|
# logger "otherpkgs: $result"
|
|
|
|
# fi
|
|
|
|
#done
|
2008-09-11 04:43:33 +00:00
|
|
|
|
|
|
|
#on AIX use geninstall
|
2008-09-26 23:07:45 +00:00
|
|
|
#PKGS=`echo "$OTHERPKGS" | tr "," " "`
|
|
|
|
#cd /xcatpost/post/otherpkgs/$OSVER/$ARCH
|
|
|
|
#result=`geninstall -I aX -Y -d /xcatpost/post/otherpkgs/$OSVER/$ARCH $PKGS 2>&1`
|
|
|
|
#rc=$?
|
|
|
|
#if [ $rc -ne 0 ]; then
|
|
|
|
# echo "$result"
|
|
|
|
# logger "otherpkgs: $result"
|
|
|
|
#fi
|
|
|
|
#exit $rc
|
|
|
|
|
|
|
|
echo "Please use nimnodecust command to add additional packages to AIX nodes."
|
|
|
|
logger "xCAT otherpkgs: Please use nimnodecust command to add addition packages to AIX nodes."
|
2008-09-08 18:54:30 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|