Before adding the os repos and otherpkgs repos, check if the repos were already added by xCAT in the previous run, if yes, update these repos; otherwise, create these repos directly. For the os repo added by addsiteyum, it should be deleted by ospkgs and otherpkgs, the ospkg and otherpkgs will add the os repos point to more directories. After ospkg/otherpkgs is done, do not remove the repos.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15512 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2013-03-14 07:47:46 +00:00
parent c4e7fe9f02
commit 2fbdba3fe3

View File

@ -252,6 +252,108 @@ else
fi
fi
#########################
##start collecting the repositories for os
if [ -z "$OSPKGDIR" ]; then
OSPKGDIR="$INSTALLDIR/$OSVER/$ARCH"
fi
if [ "$KERNELDIR" != "" ]; then
OSPKGDIR="$OSPKGDIR,$KERNELDIR"
fi
OIFS=$IFS
IFS=$','
if ( pmatch "$OSVER" "ubuntu*" ); then
IFS=$(printf ',')
fi
array_ospkgdirs=($OSPKGDIR)
IFS=$OIFS
array_empty os_path
index=0
for dir in ${array_ospkgdirs[@]}
do
default_pkgdir="$INSTALLDIR/$OSVER/$ARCH"
OSPKGDIR="$OSPKGDIR"
if [ $mounted -eq 0 ]; then
#OSPKGDIR="$OSPKGDIR"
ospkgdir="$NFSSERVER$dir"
else
ospkgdir="$dir"
fi
# for the os base pkg dir(default_pkgdir) , there are some special cases.
# (1)for rhels6, there is one repodata in the os base dir; so keep it here, and handle the other cases below
# (2)for sles, we should specified the baseurl should be ./install/sles11/ppc64/1
# (3)for SL5, we should append the /SL
# (4) for other os, we just keep it here.
# For other pkg paths, we just keep it here.
if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then
if ( pmatch "$OSVER" "sles*" ); then
OSPKGDIR="$OSPKGDIR/1"
ospkgdir="$ospkgdir/1"
elif ( pmatch "$OSVER" "SL5*" ); then
OSPKGDIR="$OSPKGDIR/SL"
ospkgdir="$ospkgdir/SL"
fi
fi
array_set_element os_path $index $ospkgdir
if ( pmatch "$OSVER" "rhel*" ); then
#default_pkgdir="$INSTALLDIR/$OSVER/$ARCH"
if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then
if ( pmatch "$OSVER" "rhels6*" ); then
if [ $ARCH == "ppc64" ]; then
ospkgdir_ok="$ospkgdir/Server"
index=$(expr $index + 1)
array_set_element os_path $index $ospkgdir_ok
fi
if [ $ARCH == "x86_64" ]; then
for arg in "Server" "ScalableFileSystem" "HighAvailability" "ResilientStorage" "LoadBalancer"
do
ospkgdir_ok="$ospkgdir/$arg"
index=$(expr $index + 1)
array_set_element os_path $index $ospkgdir_ok
done
fi
elif ( pmatch "$OSVER" "rhels5*" ); then
# for rhels5, the repodata is in ./Server, ./Cluster, ./CusterStorage, not in ./
ospkgdir_ok="$ospkgdir/Server"
array_set_element os_path $index $ospkgdir_ok
if [ $ARCH == "x86_64" ]; then
for arg in "Cluster" "ClusterStorage"
do
ospkgdir_ok="$ospkgdir/$arg"
index=$(expr $index + 1)
array_set_element os_path $index $ospkgdir_ok
done
fi # x86_64
fi # if...elif..fi
fi # eq default_pkgdir
fi # match rhel*
index=$(expr $index + 1)
done
#fi
if [ "$SDKDIR" != "" ]; then
if [ $mounted -eq 0 ]; then
SDKDIR="$NFSSERVER/$SDKDIR"
fi
fi
##end collecting the repositories for os
#########################
echo NFSSERVER=$NFSSERVER
logger -p local4.info -t xcat "NFSSERVER=$NFSSERVER"
echo OTHERPKGDIR=$OTHERPKGDIR
@ -297,6 +399,111 @@ else
fi
fi
###########
##start generating the os pkg repositories
if ( pmatch "$OSVER" "sles11*" && [ $haszypper -eq 1 ] ); then
old_repo=`zypper lr |grep -e "^[0-9]" | cut -f2 -d '|'`
for x in $old_repo
do
result=`zypper rr $x`
done
result=`zypper --non-interactive refresh 2>&1`
SUM=$(array_get_size os_path)
i=0
if [ $SUM -eq 0 ]; then
if [ $mounted -eq 0 ]; then
path="http://$OSPKGDIR"
else
path="file://$OSPKGDIR"
fi
result=`zypper ar $path xCAT-$OSVER 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER\n $result"
echo "ospkgs: zypper ar $path xCAT-$OSVER"
echo " $result"
fi
fi
else
while [ $i -lt $SUM ]; do
OSPKGDIR=$(array_get_element os_path $i)
if [ $mounted -eq 0 ]; then
path="http://$OSPKGDIR"
else
path="file://$OSPKGDIR"
fi
result=`zypper ar $path xCAT-$OSVER-"path$i" 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $path xCAT-$OSVER-path$i\n $result"
echo "ospkgs: zypper ar $path xCAT-$OSVER-path$i"
echo " $result"
fi
fi
i=$((i+1))
done
fi
if [ "$SDKDIR" != "" ]; then
if [ $mounted -eq 0 ]; then
SDKDIR="http://$SDKDIR"
else
SDKDIR="file://$SDKDIR"
fi
result=`zypper ar $SDKDIR xCAT-$OSVER-sdk 2>&1`
if [ $? -ne 0 ]; then
if ( ! pmatch "$result" "*exists*" ); then
logger -t xcat -p local4.info "ospkgs: zypper ar $SDKDIR xCAT-$OSVER-sdk\n $result"
echo "ospkgs: zypper ar $SDKDIR xCAT-$OSVER-sdk"
echo " $result"
fi
fi
fi
result=`zypper --non-interactive --no-gpg-checks refresh 2>&1`
elif ( pmatch "$OSVER" "rhel*" && [ $hasyum -eq 1 ] ); then
#remove old repo
mkdir -p /etc/yum.repos.d
if [ -r "/etc/yum.repos.d/local-repository.repo" ]; then
result=`rm /etc/yum.repos.d/local-repository.repo 2>&1`
fi
result=`rm /etc/yum.repos.d/xCAT*.repo 2>&1`
result=`yum clean all`
SUM=$(array_get_size os_path)
i=0
while [ $i -lt $SUM ]; do
REPOFILE="/etc/yum.repos.d/xCAT-$OSVER-path$i.repo"
OSPKGDIR=$(array_get_element os_path $i)
if [ ! -f $REPOFILE ]; then
echo "[xCAT-$OSVER-path$i]" > $REPOFILE
echo "name=xCAT-$OSVER-path$i" >> $REPOFILE
if [ $mounted -eq 0 ]; then
echo "baseurl=http://$OSPKGDIR" >> $REPOFILE
else
echo "baseurl=file://$OSPKGDIR" >> $REPOFILE
fi
echo "enabled=1" >> $REPOFILE
echo "gpgcheck=0" >> $REPOFILE
fi
i=$((i+1))
done
fi
##end generating the os pkg repositories
###########
###########
# To support the #NEW_INSTALL_LIST# entry in otherpkgs.pkglist files,
# multiple lists of packages are provided to this script in the form: