diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 794355cef..01419fa6c 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.3 +# Version 1.0.5 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -136,14 +136,7 @@ GO_XCAT_DEFAULT_BASE_URL="http://xcat.org/files/xcat/repos" GO_XCAT_DEFAULT_INSTALL_PATH="/install/xcat" # The package list of xcat-core -GO_XCAT_CORE_PACKAGE_LIST=(perl-xCAT xCAT xCAT-SoftLayer xCAT-buildkit - xCAT-client xCAT-confluent xCAT-genesis-scripts-ppc64 - xCAT-genesis-scripts-x86_64 xCAT-server xCAT-test xCAT-vlan xCATsn) -# For Debian/Ubuntu, it will need a sight different package list -type dpkg >/dev/null 2>&1 && -GO_XCAT_CORE_PACKAGE_LIST=(perl-xcat xcat xcat-buildkit xcat-client - xcat-confluent xcat-genesis-scripts-amd64 xcat-genesis-scripts-ppc64 - xcat-server xcat-test xcat-vlan xcatsn) +GO_XCAT_CORE_PACKAGE_LIST=() GO_XCAT_DEP_PACKAGE_LIST=() # The package list of all the packages should be installed @@ -293,7 +286,7 @@ function internal_cleanup() # function custom_setup() { - check_exec_or_exit awk cat printf sort sleep tee + check_exec_or_exit awk cat comm printf sleep tee check_root_or_exit } @@ -1168,12 +1161,12 @@ function update_xcat() { local -i i=0 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'." local -a install_list=($( - for p in "${GO_XCAT_INSTALL_LIST[@]}" \ - $(get_package_list xcat-core) - do - echo "${p}" - done | sort -u + comm <(echo "${GO_XCAT_INSTALL_LIST[@]}") \ + <(echo "${xcat_core_package_list[@]}") )) for i in "${!install_list[@]}" do @@ -1186,14 +1179,10 @@ function update_xcat() function list_xcat_packages() { - GO_XCAT_CORE_PACKAGE_LIST=($( - for p in "${GO_XCAT_CORE_PACKAGE_LIST[@]}" \ - $(get_package_list xcat-core) - do - echo "${p}" - done | sort -u - )) + GO_XCAT_CORE_PACKAGE_LIST=($(get_package_list xcat-core)) + exit_if_bad "$?" "Fail 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'." local -i cols="$(type tput >/dev/null 2>&1 && tput cols)" [[ "${cols}" -lt 80 ]] && cols=80 @@ -1484,9 +1473,9 @@ echo echo -n "Reading repositories " show_progress_meters ERR_MSG="$({ - if add_xcat_core_repo "${GO_XCAT_YES[@]}" "${GO_XCAT_CORE_URL}" "${GO_XCAT_VERSION}" + if add_xcat_core_repo -y "${GO_XCAT_CORE_URL}" "${GO_XCAT_VERSION}" then - if add_xcat_dep_repo "${GO_XCAT_YES[@]}" "${GO_XCAT_DEP_URL}" + if add_xcat_dep_repo -y "${GO_XCAT_DEP_URL}" then update_repo && exit 0 remove_repo "xcat-dep" @@ -1524,15 +1513,13 @@ case "${GO_XCAT_ACTION}" in exit 0 esac fi - ( - # Use `-y' here. Since the STDOUT is redirect to tee. - # `yum' does not display the prompt message properly when - # working with tee. - "${GO_XCAT_INSTALLER}" -y 2>&1 1>&42 | - tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stderr" >&2 - exit "${PIPESTATUS[0]}" - ) 42>&1 | tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stdout" - RET="${PIPESTATUS[0]}" + # Use `-y' here. Since the STDOUT is redirect to tee. + # `yum' does not display the prompt message properly when + # working with tee. + "${GO_XCAT_INSTALLER}" -y \ + > >(tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stdout") \ + 2> >(tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stderr" >&2) + RET="$?" { # Creating logs echo "-- 8< -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"