From da517259e98a0f30826f9a8650f3f7741adbc7eb Mon Sep 17 00:00:00 2001 From: gentle_hu Date: Thu, 18 Jul 2024 15:53:40 +0800 Subject: [PATCH] add version mode into version.cfg --- build/script/cmake_package_mini.sh | 6 +++++- build/script/utils/cmake_compile.sh | 14 +++++++++++++- build/script/utils/make_compile.sh | 10 ++++++++++ docker/upgrade/upgrade_common.sh | 8 ++++---- liteom/upgrade_common.sh | 8 ++++---- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/build/script/cmake_package_mini.sh b/build/script/cmake_package_mini.sh index a1b83182e..7e918aed0 100644 --- a/build/script/cmake_package_mini.sh +++ b/build/script/cmake_package_mini.sh @@ -529,6 +529,10 @@ function install_gaussdb() commitid=$(LD_PRELOAD='' ${BUILD_DIR}/bin/gaussdb -V | cut -d ")" -f 1 | awk '{print $NF}') echo "${commitid}" >>${SCRIPT_DIR}/version.cfg echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1 + + #insert the version mode to version.cfg + echo "$version_mode" >> ${SCRIPT_DIR}/version.cfg + echo "End insert version mode into version cfg" >> "$LOG_FILE" 2>&1 } ####################################################################### @@ -811,4 +815,4 @@ mkdir ${ROOT_DIR}/output mv ${ROOT_DIR}/build/script/*.tar.gz ${ROOT_DIR}/output/ test -e ${ROOT_DIR}/build/script/gaussdb.map && mv ${ROOT_DIR}/build/script/gaussdb.map ${ROOT_DIR}/output/ echo "now, all packages has finished!" -exit 0 \ No newline at end of file +exit 0 diff --git a/build/script/utils/cmake_compile.sh b/build/script/utils/cmake_compile.sh index 3a5c68074..0caa1fa31 100644 --- a/build/script/utils/cmake_compile.sh +++ b/build/script/utils/cmake_compile.sh @@ -63,6 +63,15 @@ function get_kernel_commitid() echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1 } +####################################################################### +##insert the version mode to version.cfg +####################################################################### +function get_version_mode() +{ + echo "$version_mode" >> ${SCRIPT_DIR}/version.cfg + echo "End insert version mode into version cfg" >> "$LOG_FILE" 2>&1 +} + ####################################################################### ## generate the version file. ####################################################################### @@ -157,6 +166,9 @@ function install_gaussdb() #insert the commitid to version.cfg as the upgrade app path specification get_kernel_commitid + + #insert the version mode to version.cfg + get_version_mode } ####################################################################### @@ -177,4 +189,4 @@ function gaussdb_build() echo "please input right paramenter values server or libpq " exit 1 esac -} \ No newline at end of file +} diff --git a/build/script/utils/make_compile.sh b/build/script/utils/make_compile.sh index c4513f54f..d5d7f83d4 100644 --- a/build/script/utils/make_compile.sh +++ b/build/script/utils/make_compile.sh @@ -70,6 +70,15 @@ function get_kernel_commitid() echo "End insert commitid into version.cfg" >> "$LOG_FILE" 2>&1 } +####################################################################### +##insert the version mode to version.cfg +####################################################################### +function get_version_mode() +{ + echo "$version_mode" >> ${SCRIPT_DIR}/version.cfg + echo "End insert version mode into version cfg" >> "$LOG_FILE" 2>&1 +} + ####################################################################### ## generate the version file. ####################################################################### @@ -320,6 +329,7 @@ function install_gaussdb() chmod 444 ${BUILD_DIR}/bin/cluster_guc.conf dos2unix ${BUILD_DIR}/bin/cluster_guc.conf > /dev/null 2>&1 get_kernel_commitid + get_version_mode } ####################################################################### diff --git a/docker/upgrade/upgrade_common.sh b/docker/upgrade/upgrade_common.sh index f99551116..fb63888ad 100644 --- a/docker/upgrade/upgrade_common.sh +++ b/docker/upgrade/upgrade_common.sh @@ -298,14 +298,14 @@ function check_version() { if [[ ! -f ${GAUSSHOME}/version.cfg ]]; then die "Cannot find current version.cfg!" ${err_upgrade_pre} fi - old_version=$(tail -n 1 $GAUSSHOME/version.cfg) + old_version=$(sed -n 3p $GAUSSHOME/version.cfg) old_cfg=$(sed -n 2p "$GAUSSHOME"/version.cfg | sed 's/\.//g') # get new version if [[ ! -f $UPGRADE_NEW_PKG_PATH/version.cfg ]]; then die "Cannot find new version.cfg!" ${err_upgrade_pre} fi - new_version=$(tail -n 1 $UPGRADE_NEW_PKG_PATH/version.cfg) + new_version=$(sed -n 3p $UPGRADE_NEW_PKG_PATH/version.cfg) new_cfg=$(sed -n 2p $UPGRADE_NEW_PKG_PATH/version.cfg | sed 's/\.//g') if [[ X"$old_version" == X || X"$old_cfg" == X || X"$new_version" == X || X"$new_cfg" == X ]]; then @@ -510,7 +510,7 @@ function cp_pkg() { new_bin_path="$GAUSS_TMP_PATH"/install_bin_"$new_version" fi #check pkg's version.cfg is equal to version_flag - temppkg_version=$(tail -n 1 "$new_bin_path"/version.cfg) + temppkg_version=$(sed -n 3p "$new_bin_path"/version.cfg) if [[ "$new_version" != "$temppkg_version" ]]; then die "pkg's version.cfg is not correct!" ${err_upgrade_bin} fi @@ -1076,7 +1076,7 @@ function check_real_gaussdb_version() { die "Get real gaussdb version failed" ${err_upgrade_bin} fi local new_version="" - new_version=`tail -n 1 $UPGRADE_NEW_PKG_PATH/version.cfg` + new_version=`sed -n 3p $UPGRADE_NEW_PKG_PATH/version.cfg` debug "new_version: $new_version" debug "real_gaussdb_version: $real_gaussdb_version" if ! echo "$real_gaussdb_version" | grep "$new_version" > /dev/null; then diff --git a/liteom/upgrade_common.sh b/liteom/upgrade_common.sh index 1e92fc31a..e0fe9057b 100644 --- a/liteom/upgrade_common.sh +++ b/liteom/upgrade_common.sh @@ -275,7 +275,7 @@ function check_version() { if [[ ! -f "${GAUSSHOME}/version.cfg" ]]; then die "Cannot find current version.cfg!" ${err_upgrade_pre} else - old_version=$(tail -n 1 "$GAUSSHOME"/version.cfg) + old_version=$(sed -n 3p "$GAUSSHOME"/version.cfg) old_cfg=$(sed -n 2p "$GAUSSHOME"/version.cfg | sed 's/\.//g') fi if [[ -f "$GAUSS_UPGRADE_BIN_PATH"/version.cfg ]]; then @@ -286,7 +286,7 @@ function check_version() { die "Cannot find new version.cfg!" ${err_upgrade_pre} fi - new_version=$(tail -n 1 "$new_version_cfg_path") + new_version=$(sed -n 3p "$new_version_cfg_path") new_cfg=$(sed -n 2p "$new_version_cfg_path" | sed 's/\.//g') if [[ X"$old_version" == X || X"$old_cfg" == X || X"$new_version" == X || X"$new_cfg" == X ]]; then @@ -503,7 +503,7 @@ function cp_pkg() { die "chmod files or dirs failed" ${err_upgrade_bin} fi #check pkg's version.cfg is equal to version_flag - temppkg_version=$(tail -n 1 "$new_bin_path"/version.cfg) + temppkg_version=$(sed -n 3p "$new_bin_path"/version.cfg) if [[ "$new_version" != "$temppkg_version" ]]; then die "pkg's version.cfg is not correct!" ${err_upgrade_bin} fi @@ -1253,4 +1253,4 @@ function delete_tmp_files() { fi rm -f "$GAUSS_TMP_PATH"/version_flag rm -f "$GAUSS_TMP_PATH"/record_step.txt -} \ No newline at end of file +}