diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 3a1c74191..75b15ea98 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,9 +2,9 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.38 +# Version 1.0.40 # -# Copyright (C) 2016, 2017, 2018 International Business Machines +# Copyright (C) 2016 - 2019 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) # # @@ -748,19 +748,36 @@ function get_package_list_apt() local repo_id="$1" [[ -z "${repo_id}" ]] && return 1 local -i rc=0 - awk '/^Package: / { print $2 }' \ - "/var/lib/apt/lists/"*"_${repo_id}_dists"*"_main_binary-"*"_Packages" \ - 2>/dev/null - # This is a dirty hack, and use recursion. + local -a lists=() + local -a packages=() + local p + local q + + for p in \ + "/var/lib/apt/lists/"*"_${repo_id}_dists"*"_main_binary-"*"_Packages" + do + [[ -f "${p}" && -r "${p}" ]] && lists+=("${p}") + done # For the `devel' branch of the online repo for apt, it has the # subdirectory name of `core-snap' instead of `xcat-core'. - rc="$?" - if [[ "${rc}" -ne "0" && "${repo_id}" = "xcat-core" ]] - then - "${FUNCNAME}" "core-snap" - rc="$?" - fi - return "${rc}" + [[ "${repo_id}" == "xcat-core" ]] && + for p in \ + "/var/lib/apt/lists/"*"_core-snap_dists"*"_main_binary-"*"_Packages" + do + [[ -f "${p}" && -r "${p}" ]] && lists+=("${p}") + done + [[ "${#lists[@]}" -eq "0" ]] && return 1 + + while read -r q + do + for p in "${packages[@]}" + do + [[ "${q}" == "${p}" ]] && continue 2 + done + packages+=("${q}") + done < <(awk '/^Package: / { print $2 }' "${lists[@]}" 2>/dev/null) + + echo "${packages[@]}" } # $1 repo id @@ -866,6 +883,8 @@ function download_file_curl() 88) echo -n "FTP chunk callback reported error" ;; 89) echo -n "no connection available, the session will be queued" ;; 90) echo -n "SSL public key does not matched pinned public key" ;; + 91) echo -n "invalid SSL certificate status" ;; + 92) echo -n "stream error in HTTP/2 framing layer" ;; *) echo -n "unknown error" ;; esac echo ")"