From 573966c85022ba71eb02195d0ae98eb988206ed8 Mon Sep 17 00:00:00 2001 From: nicmays Date: Thu, 30 Apr 2020 16:21:55 -0400 Subject: [PATCH 1/6] handled an edge case to treat a 'stable' flag as a latest flag in a cmd call go-xcat install --xcat-version=stable. --- xCAT-server/share/xcat/tools/go-xcat | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 2b3750d66..d6ba38bdd 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1322,6 +1322,12 @@ function add_xcat_core_repo_yum_or_zypper() local ver="$2" local tmp="" [[ -z "${ver}" ]] && ver="latest" + + if [[ ${ver} == "stable" ]] + then + ver="latest" + fi + if [[ -z "${url}" ]] then case "${ver}" in @@ -1348,6 +1354,12 @@ function add_xcat_core_repo_apt() local ver="$2" local tmp="" [[ -z "${ver}" ]] && ver="latest" + + if [[ ${ver} == "stable" ]] + then + ver="latest" + fi + if [[ -z "${url}" ]] then # get the apt.key @@ -1382,6 +1394,12 @@ function add_xcat_dep_repo_yum_or_zypper() local url="$1" local ver="$2" [[ -z "${ver}" ]] && ver="latest" + + if [[ ${ver} == "stable" ]] + then + ver="latest" + fi + local tmp="" local install_path="${GO_XCAT_DEFAULT_INSTALL_PATH}" local distro="${GO_XCAT_LINUX_DISTRO}${GO_XCAT_LINUX_VERSION%%.*}" @@ -1450,6 +1468,12 @@ function add_xcat_dep_repo_apt() local url="$1" local ver="$2" [[ -z "${ver}" ]] && ver="latest" + + if [[ ${ver} == "stable" ]] + then + ver="latest" + fi + [[ -z "${url}" ]] && url="${GO_XCAT_DEFAULT_BASE_URL}/apt/${ver}/xcat-dep" add_repo_by_url_apt "${url}" "xcat-dep" From 9b99c07d0da0052f484c005346b33f13958f832b Mon Sep 17 00:00:00 2001 From: nicmays Date: Mon, 4 May 2020 12:09:17 -0400 Subject: [PATCH 2/6] added some tracing. --- xCAT-server/share/xcat/tools/go-xcat | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index d6ba38bdd..e6f2a705f 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1322,6 +1322,8 @@ function add_xcat_core_repo_yum_or_zypper() local ver="$2" local tmp="" [[ -z "${ver}" ]] && ver="latest" + + echo "\nim here!!!!!\n" if [[ ${ver} == "stable" ]] then @@ -1355,6 +1357,8 @@ function add_xcat_core_repo_apt() local tmp="" [[ -z "${ver}" ]] && ver="latest" + echo "\nim here2!!!!!\n" + if [[ ${ver} == "stable" ]] then ver="latest" @@ -1395,6 +1399,8 @@ function add_xcat_dep_repo_yum_or_zypper() local ver="$2" [[ -z "${ver}" ]] && ver="latest" + echo "\nim here3!!!!!\n" + if [[ ${ver} == "stable" ]] then ver="latest" @@ -1469,6 +1475,8 @@ function add_xcat_dep_repo_apt() local ver="$2" [[ -z "${ver}" ]] && ver="latest" + echo "\nim here4!!!!!\n" + if [[ ${ver} == "stable" ]] then ver="latest" From 7bdad3e2fc96497aa1f7f1b3e8c10868dfbecba5 Mon Sep 17 00:00:00 2001 From: nicmays Date: Mon, 4 May 2020 12:57:54 -0400 Subject: [PATCH 3/6] Attempting to default to latest if stable is specified in the main program versus the function calls. --- xCAT-server/share/xcat/tools/go-xcat | 33 +++++----------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index e6f2a705f..bf37f8326 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1322,13 +1322,6 @@ function add_xcat_core_repo_yum_or_zypper() local ver="$2" local tmp="" [[ -z "${ver}" ]] && ver="latest" - - echo "\nim here!!!!!\n" - - if [[ ${ver} == "stable" ]] - then - ver="latest" - fi if [[ -z "${url}" ]] then @@ -1356,13 +1349,6 @@ function add_xcat_core_repo_apt() local ver="$2" local tmp="" [[ -z "${ver}" ]] && ver="latest" - - echo "\nim here2!!!!!\n" - - if [[ ${ver} == "stable" ]] - then - ver="latest" - fi if [[ -z "${url}" ]] then @@ -1399,13 +1385,6 @@ function add_xcat_dep_repo_yum_or_zypper() local ver="$2" [[ -z "${ver}" ]] && ver="latest" - echo "\nim here3!!!!!\n" - - if [[ ${ver} == "stable" ]] - then - ver="latest" - fi - local tmp="" local install_path="${GO_XCAT_DEFAULT_INSTALL_PATH}" local distro="${GO_XCAT_LINUX_DISTRO}${GO_XCAT_LINUX_VERSION%%.*}" @@ -1475,13 +1454,6 @@ function add_xcat_dep_repo_apt() local ver="$2" [[ -z "${ver}" ]] && ver="latest" - echo "\nim here4!!!!!\n" - - if [[ ${ver} == "stable" ]] - then - ver="latest" - fi - [[ -z "${url}" ]] && url="${GO_XCAT_DEFAULT_BASE_URL}/apt/${ver}/xcat-dep" add_repo_by_url_apt "${url}" "xcat-dep" @@ -2049,6 +2021,11 @@ do shift done +if [[ ${GO_XCAT_VERSION} == "stable" ]] + then + ${GO_XCAT_VERSION} = "latest" +fi + case "${GO_XCAT_ACTION}" in "away") GO_XCAT_YES=("-y") From a2cb534bb6f5b1fc2b7ca75e5156f3c9f554cebf Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 May 2020 14:54:38 -0400 Subject: [PATCH 4/6] Changed code to handle the stable flag inside the swtich statement where we parse the command in the main program. --- xCAT-server/share/xcat/tools/go-xcat | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index bf37f8326..355e2e089 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1993,9 +1993,17 @@ do "-x"|"--xcat-version") shift GO_XCAT_VERSION="$1" + if [ "${GO_XCAT_VERSION}" = "stable" ]; + then + GO_XCAT_VERSION="latest" + fi ;; "--xcat-version="*) GO_XCAT_VERSION="${1##--xcat-version=}" + if [ "${GO_XCAT_VERSION}" = "stable" ]; + then + GO_XCAT_VERSION="latest" + fi ;; "-y"|"--yes") GO_XCAT_YES=("-y") @@ -2021,11 +2029,6 @@ do shift done -if [[ ${GO_XCAT_VERSION} == "stable" ]] - then - ${GO_XCAT_VERSION} = "latest" -fi - case "${GO_XCAT_ACTION}" in "away") GO_XCAT_YES=("-y") From e0469145ebd9bd23a0a4749bcd7b8b047d6243b2 Mon Sep 17 00:00:00 2001 From: nicmays Date: Tue, 5 May 2020 17:23:28 -0400 Subject: [PATCH 5/6] redacting the if statement for -x specifications. --- xCAT-server/share/xcat/tools/go-xcat | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 355e2e089..39a09751d 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1993,10 +1993,6 @@ do "-x"|"--xcat-version") shift GO_XCAT_VERSION="$1" - if [ "${GO_XCAT_VERSION}" = "stable" ]; - then - GO_XCAT_VERSION="latest" - fi ;; "--xcat-version="*) GO_XCAT_VERSION="${1##--xcat-version=}" From ce92aab9e37ef7c4353a95a9524cc039a8aec5ad Mon Sep 17 00:00:00 2001 From: nicmays Date: Thu, 7 May 2020 12:17:41 -0400 Subject: [PATCH 6/6] updated the file header and version number with the enhancement, added an example to the examples section. --- xCAT-server/share/xcat/tools/go-xcat | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 39a09751d..9d8e76abd 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.45 +# Version 1.0.46 # # Copyright (C) 2016 - 2019 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -29,8 +29,12 @@ # - Display a list of packages that could not be uninstalled # 2019-11-05 Mark Gurevich # - Display a list of packages that will be installed before "Continue?" +# 2020-5-7 Nic Mays +# - Handles 'stable' as a flag to install latest version via the command: +# go-xcat --xcat-version=stable install # + function usage() { local script="${0##*/}" @@ -72,6 +76,7 @@ function usage() ${script} --yes install ${script} -x 2.12 -y install ${script} --xcat-version=devel install + ${script} --xcat-version=stable install ${script} --xcat-core=/path/to/xcat-core.tar.bz2 \\ --xcat-dep=/path/to/xcat-dep.tar.bz2 install ${script} --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 \\