2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-20 02:00:24 +00:00

Merge pull request #6345 from neo954/go-xcat

Cumulative go-xcat updates
This commit is contained in:
yangsong
2019-05-27 16:07:09 +08:00
committed by GitHub

View File

@@ -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)
# <http://www.eclipse.org/legal/epl-v10.html>
#
@@ -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 ")"