1. fix error message when removing a package in ubuntu, 2. fix error message when update packages, 3. fix apt source not correct in ospkgs

This commit is contained in:
Leo.C.Wu 2015-01-07 15:35:14 +08:00
parent c2c9052396
commit 0b2ca38509
2 changed files with 30 additions and 10 deletions

View File

@ -338,12 +338,14 @@ groups='' #groups
pkgs_d='' #packages to remove
OIFS=$IFS
IFS=$'\n'
IFS=$','
if ( pmatch "$OSVER" "ubuntu*" ); then
IFS=$(printf '\n')
IFS=$(printf ',')
fi
pkgarray=($OSPKGS)
IFS=$OIFS
for x in `echo "$OSPKGS" | tr "," "\n"`
for x in ${pkgarray[@]};
do
#remove leading and trailing spaces
x=`echo $x |sed 's/^ *//;s/ *$//'`
@ -370,7 +372,6 @@ do
fi
fi
done
IFS=$OIFS
if [ $debug -ne 0 ]; then
echo "pkgs=$pkgs"
@ -658,12 +659,31 @@ elif ( pmatch "$OSVER" "ubuntu*" ); then
exit 1
fi
# No need to setup a /etc/apt/sources.list.d/ file because installation
# should already lead to /etc/apt/sources.list including the xcat install
# media repository.
# setup apt source for os distro updates
# check whether the os package path in primary apt source (/etc/apt/sources.list) or not
# if the os package path does not exist in /etc/apt/sources.list,
# create apt source file in /etc/apt/sources.list.d
prirepo=/etc/apt/sources.list
repoprefix=/etc/apt/sources.list.d/xCAT-${OSVER}-path
oldif=$IFS
IFS=","
pkgdirs=($OSPKGDIR)
IFS=$oldif
repocount=0
for dir in ${pkgdirs[@]}; do
if grep "^deb\ .*$dir" $prirepo; then
continue
fi
#create apt source file in /etc/apt/sources.list.d
echo "deb http://$NFSSERVER/$dir ./" > "${repoprefix}${repocount}.list"
repocount=$(($repocount+1))
done
# upgrade existing packages
command="apt-get -y upgrade"
apt-get -y update
command="DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --force-yes -o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef' upgrade "
echo "=== $command"
eval $command
R=$?

View File

@ -788,9 +788,9 @@ EOF`
elif [ $hasapt -eq 1 ]; then
apt_get_update_if_repos_changed $REPOFILE
if [ $VERBOSE ]; then
echo "$envlist DEBIAN_FRONTEND=noninteractive apt-get -y upgrade"
echo "$envlist DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --force-yes -o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef' upgrade"
fi
result=`eval $envlist DEBIAN_FRONTEND=noninteractive apt-get -y upgrade 2>&1`
result=`eval $envlist DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --force-yes -o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef' upgrade 2>&1`
R=$?
if [ $R -ne 0 ]; then
RETURNVAL=$R