diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index abb4b3219d..4138e52d8a 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -619,6 +619,35 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do repo_base="/etc/apt/sources.list.d" fi + + urlrepoindex=0 + #add repo for url repos in otherpkgdir + if [ -n "OTHERPKGDIR_INTERNET" ];then + OIFS=$IFS + IFS=',' + OTHERPKGDIRLIST_INTERNET=($OTHERPKGDIR_INTERNET) + + + for url in ${OTHERPKGDIRLIST_INTERNET[@]} + do + if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then + REPOFILE="$repo_base/xCAT-otherpkgs$urlrepoindex.repo" + echo "[xcat-otherpkgs$urlrepoindex]" > $REPOFILE + echo "name=xcat-otherpkgs$urlrepoindex" >> $REPOFILE + echo "baseurl=$url" >> $REPOFILE + echo "enabled=1" >> $REPOFILE + echo "gpgcheck=0" >> $REPOFILE + + elif [ $hasapt -eq 1 ] ; then + REPOFILE="$repo_base/xCAT-otherpkgs${urlrepoindex}.list" + echo "deb "$url >> $REPOFILE + fi + urlrepoindex=$[urlrepoindex+1] + done + + IFS=$OIFS + fi + array_empty repo_path repo_pkgs="" repo_pkgs_preremove="" @@ -700,10 +729,11 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do #try to add the path to the repo if [ $try_repo -eq 1 ]; then index=$(array_get_size repo_path) + localrepoindex=$[urlrepoindex+index] if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then - REPOFILE="$repo_base/xCAT-otherpkgs$index.repo" - echo "[xcat-otherpkgs$index]" > $REPOFILE - echo "name=xcat-otherpkgs$index" >> $REPOFILE + REPOFILE="$repo_base/xCAT-otherpkgs$localrepoindex.repo" + echo "[xcat-otherpkgs$localrepoindex]" > $REPOFILE + echo "name=xcat-otherpkgs$localrepoindex" >> $REPOFILE if [ $mounted -eq 0 ]; then echo "baseurl=http://$whole_path" >> $REPOFILE else @@ -722,7 +752,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do fi fi elif [ $hasapt -eq 1 ] ; then - REPOFILE="$repo_base/xCAT-otherpkgs$index.list" + REPOFILE="$repo_base/xCAT-otherpkgs$localrepoindex.list" if [ -n "$OTHERPKGDIR" ];then if [ $mounted -eq 0 ]; then type=http @@ -731,16 +761,6 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do fi echo "deb $type://$whole_path ./" > $REPOFILE fi - if [ -n "$OTHERPKGDIR_INTERNET" ] && [ $index -eq 0 ] ;then - OLDIFS=$IFS - IFS=$',' - urlarray=($OTHERPKGDIR_INTERNET) - for url in ${urlarray[@]} - do - echo "deb "$url >> $REPOFILE - done - IFS=$OLDIFS - fi fi fi if [ $hasyum -eq 1 ]; then @@ -798,38 +818,6 @@ EOF` fi done - #add repo for url repos in otherpkgdir - if [ -n "OTHERPKGDIR_INTERNET" ];then - OIFS=$IFS - IFS=',' - OTHERPKGDIRLIST_INTERNET=($OTHERPKGDIR_INTERNET) - - index=$(array_get_size repo_path) - for url in ${OTHERPKGDIRLIST_INTERNET[@]} - do - if [ $hasyum -eq 1 ] || [ $haszypper -eq 1 ] ; then - REPOFILE="$repo_base/xCAT-otherpkgs$index.repo" - echo "[xcat-otherpkgs$index]" > $REPOFILE - echo "name=xcat-otherpkgs$index" >> $REPOFILE - echo "baseurl=$url" >> $REPOFILE - echo "enabled=1" >> $REPOFILE - echo "gpgcheck=0" >> $REPOFILE - index=$[index+1] - fi - done - - IFS=$OIFS - if [ $hasyum -eq 1 ]; then - yum clean all - fi - if [ $haszypper -eq 1 ]; then - result=`zypper --non-interactive refresh 2>&1` - if [ $VERBOSE ]; then - echo "otherpkgs: zypper --non-interactive refresh" - echo " $result" - fi - fi - fi if [ "$repoonly" -eq 1 ]; then echo "otherpkgs: "repoonly set, so ignore pkg installation ...""