2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-18 20:30:56 +00:00

Merge pull request #1864 from neo954/go-xcat-devel

[go-xcat] Fix github issue #1836. Handle the situation of lack update…
Looks good now. Merging.
This commit is contained in:
Mark Gurevich
2016-09-20 11:01:07 -04:00
committed by GitHub

View File

@ -2,7 +2,7 @@
#
# go-xcat - Install xCAT automatically.
#
# Version 1.0.5
# Version 1.0.7
#
# Copyright (C) 2016 International Business Machines
# Eclipse Public License, Version 1.0 (EPL-1.0)
@ -12,6 +12,8 @@
# - created
# 2016-06-20 GONG Jie <gongjie@linux.vnet.ibm.com>
# - released to the field
# 2016-09-20 GONG Jie <gongjie@linux.vnet.ibm.com>
# - bug fix
#
function usage()
@ -286,7 +288,7 @@ function internal_cleanup()
#
function custom_setup()
{
check_exec_or_exit awk cat comm printf sleep tee
check_exec_or_exit awk cat comm grep printf sleep tee
check_root_or_exit
}
@ -477,7 +479,7 @@ function check_repo_version_yum()
{
type yum >/dev/null 2>&1 || return 255
check_executes repoquery
exit_if_bad "$?" "Install the 'yum-utils' package and rerun."
exit_if_bad "$?" "Install the \`yum-utils' package and rerun."
local -a name=()
local -a ver=()
while read -r name ver
@ -583,7 +585,7 @@ function get_package_list_yum()
{
type yum >/dev/null 2>&1 || return 255
check_executes repoquery
exit_if_bad "$?" "Install the 'yum-utils' package and rerun."
exit_if_bad "$?" "Install the \`yum-utils' package and rerun."
local repo_id="$1"
[[ -z "${repo_id}" ]] && return 1
repoquery -qa "--repoid=${repo_id}" --qf "%{name}" 2>/dev/null
@ -713,7 +715,7 @@ function extract_archive()
[[ -f "${archive}" ]]
warn_if_bad "$?" "${archive}: archive file not found!" || return 1
mkdir -p "${install_path}" 2>/dev/null
warn_if_bad "$?" "create directory \`${install_path}\' failed" ||
warn_if_bad "$?" "Failed to create directory \`${install_path}'" ||
return 1
case "${archive##*.}" in
"Z")
@ -1093,6 +1095,10 @@ function update_repo_dnf()
function update_repo_yum()
{
type yum >/dev/null 2>&1 || return 255
# Check if `yum' support `updateinfo' command.
yum --help 2>/dev/null | grep -q "^updateinfo" >/dev/null 2>&1
warn_if_bad "$?" "Lacking support of \`updateinfo' command for \`yum'."
exit_if_bad "$?" "Install the \`yum-plugin-security' package and rerun."
yum --nogpgcheck updateinfo
}
@ -1163,7 +1169,7 @@ function update_xcat()
local ver=""
local -a xcat_core_package_list
xcat_core_package_list=($(get_package_list xcat-core))
exit_if_bad "$?" "Fail to get package list from repository 'xcat-core'."
exit_if_bad "$?" "Failed to get package list from repository \`xcat-core'."
local -a install_list=($(
comm <(echo "${GO_XCAT_INSTALL_LIST[@]}") \
<(echo "${xcat_core_package_list[@]}")
@ -1180,9 +1186,9 @@ function update_xcat()
function list_xcat_packages()
{
GO_XCAT_CORE_PACKAGE_LIST=($(get_package_list xcat-core))
exit_if_bad "$?" "Fail to get package list from repository 'xcat-core'."
exit_if_bad "$?" "Failed to get package list from repository \`xcat-core'."
GO_XCAT_DEP_PACKAGE_LIST=($(get_package_list xcat-dep))
exit_if_bad "$?" "Fail to get package list from repository 'xcat-dep'."
exit_if_bad "$?" "Failed to get package list from repository \`xcat-dep'."
local -i cols="$(type tput >/dev/null 2>&1 && tput cols)"
[[ "${cols}" -lt 80 ]] && cols=80
@ -1408,13 +1414,13 @@ do
GO_XCAT_YES=("-y")
;;
"-"*)
warn_if_bad 1 "invalid option -- '$1'"
warn_if_bad 1 "invalid option -- \`$1'"
exit_if_bad 1 "Try \`$0 --help' for more information"
;;
*)
[ "$1" == "--" ] && shift
[ -z "${GO_XCAT_ACTION}" ]
warn_if_bad "$?" "redundancy action -- '$1'"
warn_if_bad "$?" "redundancy action -- \`$1'"
exit_if_bad "$?" "Try \`$0 --help' for more information"
GO_XCAT_ACTION="$1"
;;
@ -1434,7 +1440,7 @@ case "${GO_XCAT_ACTION}" in
exit 1
;;
*)
warn_if_bad 1 "invalid action -- '${GO_XCAT_ACTION}'"
warn_if_bad 1 "invalid action -- \`${GO_XCAT_ACTION}'"
exit_if_bad 1 "Try \`$0 --help' for more information"
;;
esac