From 7272daebe5f3505646ef4217ec2060d57b03c4db Mon Sep 17 00:00:00 2001 From: Qinyun Tan Date: Tue, 16 Dec 2025 16:20:06 +0800 Subject: [PATCH] anolis: scripts: Replace 'sh' with 'bash' for shell invocations ANBZ: #28106 Replace hardcoded 'sh' invocations with 'bash' to avoid compatibility issues between different distributions. On CentOS, 'sh' defaults to bash, while on Ubuntu it defaults to dash, which can lead to script failures due to syntax differences. Affected files: - configs/scripts/generate_configs.sh - configs/scripts/update_configs.sh - configs/scripts/export_configs.sh - configs/scripts/modify_config.sh - genrpmtree.sh Signed-off-by: Qinyun Tan --- anolis/configs/scripts/export_configs.sh | 4 ++-- anolis/configs/scripts/generate_configs.sh | 4 ++-- anolis/configs/scripts/modify_config.sh | 4 ++-- anolis/configs/scripts/update_configs.sh | 6 +++--- anolis/genrpmtree.sh | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/anolis/configs/scripts/export_configs.sh b/anolis/configs/scripts/export_configs.sh index 67880c39fc61..a52e8016b11b 100644 --- a/anolis/configs/scripts/export_configs.sh +++ b/anolis/configs/scripts/export_configs.sh @@ -14,7 +14,7 @@ LEVEL_INFO=${DIST_OUTPUT}/level_info mkdir -p ${DIST_OUTPUT} -sh ${SCRIPT_DIR}/generate_configs.sh | tee ${FILE_LIST} +bash ${SCRIPT_DIR}/generate_configs.sh | tee ${FILE_LIST} python3 ${SCRIPT_DIR}/anolis_kconfig.py collect_level --top_dir ${BASE_CONFIG_DIR} \ --dist ${DIST_CONFIG_KERNEL_NAME} > ${LEVEL_INFO} @@ -26,4 +26,4 @@ python3 ${SCRIPT_DIR}/anolis_kconfig.py export \ --output ${DIST_OUTPUT}/configs.xlsx\ ${files} -echo "* file generated: ${DIST_OUTPUT}/configs.xlsx" +echo "* file generated: ${DIST_OUTPUT}/configs.xlsx" \ No newline at end of file diff --git a/anolis/configs/scripts/generate_configs.sh b/anolis/configs/scripts/generate_configs.sh index 90617cd7bd5f..70318d5d7477 100644 --- a/anolis/configs/scripts/generate_configs.sh +++ b/anolis/configs/scripts/generate_configs.sh @@ -30,9 +30,9 @@ else done fi -sh ${DIST_OUTPUT}/generate.sh | tee ${FILE_LIST} +bash ${DIST_OUTPUT}/generate.sh | tee ${FILE_LIST} if [ "x${DIST_DO_GENERATE_DOT_CONFIG}" = "xY" ]; then file=$(cat ${FILE_LIST} | grep "processed" | awk '{print $4}' | head -1) cp -f ${file} ${DIST_SRCROOT}.config -fi +fi \ No newline at end of file diff --git a/anolis/configs/scripts/modify_config.sh b/anolis/configs/scripts/modify_config.sh index 774bc183bd7b..b52067613ae8 100644 --- a/anolis/configs/scripts/modify_config.sh +++ b/anolis/configs/scripts/modify_config.sh @@ -100,7 +100,7 @@ function add_new_configs() { function refresh_configs() { echo "refresh configs" - sh ${SCRIPT_DIR}/update_configs.sh + bash ${SCRIPT_DIR}/update_configs.sh } CHECK_FOUND_FILE=0 @@ -136,4 +136,4 @@ function main() { check_config } -main +main \ No newline at end of file diff --git a/anolis/configs/scripts/update_configs.sh b/anolis/configs/scripts/update_configs.sh index 451b7394eaab..e5566dbc32ea 100644 --- a/anolis/configs/scripts/update_configs.sh +++ b/anolis/configs/scripts/update_configs.sh @@ -42,7 +42,7 @@ function prepare_env() { function generate_configs() { # log "collect all old configs..." # generate old config files - sh ${SCRIPT_DIR}/generate_configs.sh + bash ${SCRIPT_DIR}/generate_configs.sh } function split_new_configs() { @@ -55,7 +55,7 @@ function split_new_configs() { --input_dir ${BASE_CONFIG_DIR} \ --output_dir ${NEW_CONFIG_DIR} \ --src_root ${DIST_SRCROOT} ${DIST_OUTPUT}/kconfig_import > ${DIST_OUTPUT}/import.sh - sh -e ${DIST_OUTPUT}/import.sh + bash -e ${DIST_OUTPUT}/import.sh } function replace_with_new_configs() { @@ -110,4 +110,4 @@ if [ -z "$DO_IMPORT_CONFIGS" ]; then fi split_new_configs replace_with_new_configs -check_configs +check_configs \ No newline at end of file diff --git a/anolis/genrpmtree.sh b/anolis/genrpmtree.sh index 0812a96c2688..1a5dbfccc0fc 100644 --- a/anolis/genrpmtree.sh +++ b/anolis/genrpmtree.sh @@ -22,7 +22,7 @@ function do_prep() { git archive --format=tar --prefix="${pkgname}/" ${DIST_PKG_COMMIT_ID} | xz -T$(nproc) > ${DIST_RPMBUILDDIR_OUTPUT}/SOURCES/${pkgname}.tar.xz md5sum ${DIST_RPMBUILDDIR_OUTPUT}/SOURCES/${pkgname}.tar.xz > ${DIST_RPMBUILDDIR_OUTPUT}/SOURCES/download popd > /dev/null - DIST_OUTPUT=${DIST_RPMBUILDDIR_OUTPUT}/SPECS/ sh genspec.sh + DIST_OUTPUT=${DIST_RPMBUILDDIR_OUTPUT}/SPECS/ bash genspec.sh # the kconfigs of x86 and arm64 has been moved to kconfig baseline, # so use `make dist-configs` to generate them @@ -57,4 +57,4 @@ function do_prep() { ${DIST_RPMBUILDDIR_OUTPUT}/SOURCES/kernel-${DIST_KERNELVERSION}-sw_64-8a-debug.config } -do_prep +do_prep \ No newline at end of file -- Gitee