Merged
ops-base安装权限统一 #804
qinhanAdd on Sep 1
ops-base安装权限统一 #804
Merged
Merged fromqinhan123/opbase_v1masterintocann/opbasemaster
Total: 5 files changed+10-90
| @@ -14,12 +14,12 @@ if(NOT PROJECT_SOURCE_DIR) | |||
| 14 | else() | 14 | else() |
| 15 | include(FetchContent) | 15 | include(FetchContent) |
| 16 | 16 | ||
| 17 | - set(CANN_CMAKE_TAG "master-053") | 17 | + set(CANN_CMAKE_TAG "master-057") |
| 18 | if(CANN_3RD_LIB_PATH AND EXISTS "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz") | 18 | if(CANN_3RD_LIB_PATH AND EXISTS "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz") |
| 19 | FetchContent_Declare( | 19 | FetchContent_Declare( |
| 20 | cann-cmake | 20 | cann-cmake |
| 21 | URL "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz" | 21 | URL "${CANN_3RD_LIB_PATH}/cmake-${CANN_CMAKE_TAG}.tar.gz" |
| 22 | - URL_HASH SHA256=5ca4948c257f2ba8530d6f506e1fed3bb8d24a3ab347fb226599d37e51edc429 | 22 | + URL_HASH SHA256=ff015168a8e09838b7a40576b91c0fc94ddd6cd30d7991be842368f83fcd9f11 |
| 23 | ) | 23 | ) |
| 24 | else() | 24 | else() |
| 25 | FetchContent_Declare( | 25 | FetchContent_Declare( |
| @@ -314,7 +314,7 @@ precleanbeforeinstall() { | |||
| 314 | fi | 314 | fi |
| 315 | done | 315 | done |
| 316 | fi | 316 | fi |
| 317 | - | 317 | + |
| 318 | if [ "${_files_existed}" = "0" ]; then | 318 | if [ "${_files_existed}" = "0" ]; then |
| 319 | if [ "${is_quiet}" = y ]; then | 319 | if [ "${is_quiet}" = y ]; then |
| 320 | logandprint "[WARNING]: Directory has file existed or installed opbase \ | 320 | logandprint "[WARNING]: Directory has file existed or installed opbase \ |
| @@ -484,7 +484,7 @@ getfirstnotexistdir() { | |||
| 484 | arr=$(echo ${in_tmp_dir} | tr '/' "\n") | 484 | arr=$(echo ${in_tmp_dir} | tr '/' "\n") |
| 485 | index=0 | 485 | index=0 |
| 486 | id=-1 | 486 | id=-1 |
| 487 | - for i in $arr;do | 487 | + for i in $arr;do |
| 488 | id=$((${id:=-1}+1)) | 488 | id=$((${id:=-1}+1)) |
| 489 | eval arr_$id=$i | 489 | eval arr_$id=$i |
| 490 | index=$(expr $index + 1) | 490 | index=$(expr $index + 1) |
| @@ -510,7 +510,7 @@ matchfullpath() { | |||
| 510 | absolute_path=${1} | 510 | absolute_path=${1} |
| 511 | return | 511 | return |
| 512 | fi | 512 | fi |
| 513 | - paths="/"* | 513 | + paths="/"* |
| 514 | for i in ${paths}; do | 514 | for i in ${paths}; do |
| 515 | if [ "${1}" = "${i}" ] && [ "${1%/*}" = "" ]; then | 515 | if [ "${1}" = "${i}" ] && [ "${1%/*}" = "" ]; then |
| 516 | absolute_path="/${1##*/}" | 516 | absolute_path="/${1##*/}" |
| @@ -960,7 +960,7 @@ repairaicpu(){ | |||
| 960 | if [ "$is_for_all" = "y" ];then | 960 | if [ "$is_for_all" = "y" ];then |
| 961 | num_value_param=555 | 961 | num_value_param=555 |
| 962 | chmod $num_value_param $1/${opp_platform_dir}/built-in/op_proto/libopsproto.so > /dev/null 2>&1 | 962 | chmod $num_value_param $1/${opp_platform_dir}/built-in/op_proto/libopsproto.so > /dev/null 2>&1 |
| 963 | - chmod $num_value_param $1/${opp_platform_dir}/built-in/op_impl/ai_core/tbe/op_tiling/liboptiling.so > /dev/null 2>&1 | 963 | + chmod $num_value_param $1/${opp_platform_dir}/built-in/op_impl/ai_core/tbe/op_tiling/liboptiling.so > /dev/null 2>&1 |
| 964 | fi | 964 | fi |
| 965 | if [ $(id -u) -ne 0 ];then | 965 | if [ $(id -u) -ne 0 ];then |
| 966 | chmod $num_value_param $1/${opp_platform_dir}/built-in/op_proto/libopsproto.so > /dev/null 2>&1 | 966 | chmod $num_value_param $1/${opp_platform_dir}/built-in/op_proto/libopsproto.so > /dev/null 2>&1 |
| @@ -1142,7 +1142,7 @@ if [ "$(id -u)" = "0" ] ; then | |||
| 1142 | fi | 1142 | fi |
| 1143 | 1143 | ||
| 1144 | # pre-check | 1144 | # pre-check |
| 1145 | -if [ "${iter_i}" -eq 0 ] && [ "x${is_precheck}" = "xy" ]; then | 1145 | +if [ "${iter_i}" -eq 0 ] && [ "x${is_precheck}" = "xy" ]; then |
| 1146 | interact_pre_check | 1146 | interact_pre_check |
| 1147 | exitlog | 1147 | exitlog |
| 1148 | exit 0 | 1148 | exit 0 |
| @@ -1500,8 +1500,6 @@ user group (${_DEFAULT_USERGROUP}) for devel mode? [y/n]" | |||
| 1500 | chip_type_new=${chip_type_new} | 1500 | chip_type_new=${chip_type_new} |
| 1501 | fi | 1501 | fi |
| 1502 | sh "${_UPGRADE_SHELL_FILE}" "${_TARGET_INSTALL_PATH}" "${_DEFAULT_USERNAME}" "${_DEFAULT_USERGROUP}" ${in_feature} "${is_quiet}" "${is_for_all}" "${is_setenv}" "${is_docker_install}" "${docker_root}" "" "n" "${in_feature_new}" "${chip_type_new}" | 1502 | sh "${_UPGRADE_SHELL_FILE}" "${_TARGET_INSTALL_PATH}" "${_DEFAULT_USERNAME}" "${_DEFAULT_USERGROUP}" ${in_feature} "${is_quiet}" "${is_for_all}" "${is_setenv}" "${is_docker_install}" "${docker_root}" "" "n" "${in_feature_new}" "${chip_type_new}" |
| 1503 | - chmod -R 555 "${target_dir}/${opp_platform_dir}/script"> /dev/null 2>&1 | ||
| 1504 | - chmod -R 555 "${target_dir}/${opp_platform_dir}/bin"> /dev/null 2>&1 | ||
| 1505 | if [ $(id -u) -eq 0 ]; then | 1503 | if [ $(id -u) -eq 0 ]; then |
| 1506 | chown -R "root":"root" "${target_dir}/${opp_platform_dir}/script"> /dev/null 2>&1 | 1504 | chown -R "root":"root" "${target_dir}/${opp_platform_dir}/script"> /dev/null 2>&1 |
| 1507 | chown "root":"root" "${target_dir}/${opp_platform_dir}"> /dev/null 2>&1 | 1505 | chown "root":"root" "${target_dir}/${opp_platform_dir}"> /dev/null 2>&1 |
| @@ -1532,9 +1530,6 @@ user group (${_DEFAULT_USERGROUP}) for devel mode? [y/n]" | |||
| 1532 | if [ $(id -u) -eq 0 ]; then | 1530 | if [ $(id -u) -eq 0 ]; then |
| 1533 | chown -R "root":"root" "${target_dir}/${opp_platform_dir}/script" 2> /dev/null | 1531 | chown -R "root":"root" "${target_dir}/${opp_platform_dir}/script" 2> /dev/null |
| 1534 | chown "root":"root" "${target_dir}/${opp_platform_dir}" 2> /dev/null | 1532 | chown "root":"root" "${target_dir}/${opp_platform_dir}" 2> /dev/null |
| 1535 | - else | ||
| 1536 | - chmod -R 550 "${target_dir}/${opp_platform_dir}/script" 2> /dev/null | ||
| 1537 | - chmod 440 "${target_dir}/${opp_platform_dir}/script/filelist.csv" 2> /dev/null | ||
| 1538 | fi | 1533 | fi |
| 1539 | logoperationretstatus "install" "${in_install_type}" "$?" "${in_cmd_list}" | 1534 | logoperationretstatus "install" "${in_install_type}" "$?" "${in_cmd_list}" |
| 1540 | fi | 1535 | fi |
| @@ -1561,13 +1556,7 @@ if [ "${is_upgrade}" = "y" ];then | |||
| 1561 | fi | 1556 | fi |
| 1562 | # aicpuinfofile "add" | 1557 | # aicpuinfofile "add" |
| 1563 | repairaicpu "${target_dir}" | 1558 | repairaicpu "${target_dir}" |
| 1564 | - if [ $(id -u) -eq 0 ]; then | 1559 | + |
| 1565 | - chmod -R 555 "${target_dir}/${opp_platform_dir}/script" 2> /dev/null | ||
| 1566 | - chmod 444 "${target_dir}/${opp_platform_dir}/script/filelist.csv" 2> /dev/null | ||
| 1567 | - else | ||
| 1568 | - chmod -R 550 "${target_dir}/${opp_platform_dir}/script" 2> /dev/null | ||
| 1569 | - chmod 440 "${target_dir}/${opp_platform_dir}/script/filelist.csv" 2> /dev/null | ||
| 1570 | - fi | ||
| 1571 | # uprate precheck info to ${target_dir}/bin/prereq_check.bash | 1560 | # uprate precheck info to ${target_dir}/bin/prereq_check.bash |
| 1572 | logandprint "[INFO]: Set precheck info." | 1561 | logandprint "[INFO]: Set precheck info." |
| 1573 | logoperationretstatus "upgrade" "${install_type}" "$?" "${in_cmd_list}" | 1562 | logoperationretstatus "upgrade" "${install_type}" "$?" "${in_cmd_list}" |
| @@ -90,11 +90,9 @@ create_stub_softlink() { | |||
| 90 | fi | 90 | fi |
| 91 | local arch_name="$pkg_arch_name" | 91 | local arch_name="$pkg_arch_name" |
| 92 | ([ -d "$install_path/${arch_name}-linux/devlib" ] && cd "$install_path/${arch_name}-linux/devlib" && { | 92 | ([ -d "$install_path/${arch_name}-linux/devlib" ] && cd "$install_path/${arch_name}-linux/devlib" && { |
| 93 | - chmod u+w . && \ | ||
| 94 | for lib in $(get_stub_libs_from_filelist); do | 93 | for lib in $(get_stub_libs_from_filelist); do |
| 95 | [ -f "$lib" ] && ln -sf "$lib" "$(basename $lib)" | 94 | [ -f "$lib" ] && ln -sf "$lib" "$(basename $lib)" |
| 96 | done | 95 | done |
| 97 | - chmod u-w . | ||
| 98 | }) | 96 | }) |
| 99 | } | 97 | } |
| 100 | 98 | ||
| @@ -106,7 +104,6 @@ remove_stub_softlink() { | |||
| 106 | local arch_name="$pkg_arch_name" | 104 | local arch_name="$pkg_arch_name" |
| 107 | ([ -d "$install_path/${arch_name}-linux/devlib" ] && cd "$install_path/${arch_name}-linux/devlib" && { | 105 | ([ -d "$install_path/${arch_name}-linux/devlib" ] && cd "$install_path/${arch_name}-linux/devlib" && { |
| 108 | chmod u+w . && basename --multiple $(get_stub_libs_from_filelist) | xargs --no-run-if-empty rm -rf | 106 | chmod u+w . && basename --multiple $(get_stub_libs_from_filelist) | xargs --no-run-if-empty rm -rf |
| 109 | - chmod u-w . | ||
| 110 | }) | 107 | }) |
| 111 | } | 108 | } |
| 112 | 109 | ||
| @@ -196,7 +196,7 @@ updatefeatureandchipinfo() { | |||
| 196 | else | 196 | else |
| 197 | echo "${_key_val}=${_val}" > "${_target_install_info}" | 197 | echo "${_key_val}=${_val}" > "${_target_install_info}" |
| 198 | fi | 198 | fi |
| 199 | - | 199 | + |
| 200 | chmod 644 "${_target_install_info}" 2> /dev/null | 200 | chmod 644 "${_target_install_info}" 2> /dev/null |
| 201 | } | 201 | } |
| 202 | 202 | ||
| @@ -408,28 +408,8 @@ sh "${_COMMON_PARSER_FILE}" --copy_all --package="${ops_base_platform_dir}" --in | |||
| 408 | --version=$pkg_version --version-dir=$pkg_version_dir $install_option ${in_install_for_all} ${in_feature_1} ${chip_type_1} "${install_type}" "${_TARGET_INSTALL_PATH}" "${_FILELIST_FILE}" | 408 | --version=$pkg_version --version-dir=$pkg_version_dir $install_option ${in_install_for_all} ${in_feature_1} ${chip_type_1} "${install_type}" "${_TARGET_INSTALL_PATH}" "${_FILELIST_FILE}" |
| 409 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Install opbase module files failed." | 409 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Install opbase module files failed." |
| 410 | 410 | ||
| 411 | -#chmod to support copy | ||
| 412 | -if [ -d "${version_install_dir}/share/info/${ops_base_platform_dir}/vendors" ] && [ "$(id -u)" != "0" ]; then | ||
| 413 | - chmod -R "${_CUSTOM_PERM}" ${version_install_dir}/share/info/${ops_base_platform_dir}/vendors | ||
| 414 | -fi | ||
| 415 | - | ||
| 416 | logandprint "[INFO]: upgradePercentage:50%" | 411 | logandprint "[INFO]: upgradePercentage:50%" |
| 417 | 412 | ||
| 418 | -# change log dir and file owner and rights | ||
| 419 | -chmod "${_LOG_PATH_PERM}" "${_LOG_PATH}" 2> /dev/null | ||
| 420 | -chmod "${_LOG_FILE_PERM}" "${_INSTALL_LOG_FILE}" 2> /dev/null | ||
| 421 | -chmod "${_LOG_FILE_PERM}" "${_OPERATE_LOG_FILE}" 2> /dev/null | ||
| 422 | - | ||
| 423 | -if [ "$(id -u)" = "0" ]; then | ||
| 424 | - chmod "755" "${version_install_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null | ||
| 425 | -else | ||
| 426 | - chmod "${_BUILTIN_PERM}" "${version_install_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null | ||
| 427 | -fi | ||
| 428 | - | ||
| 429 | -chmod "${_ONLYREAD_PERM}" "${version_install_dir}""/share/info/${ops_base_platform_dir}/scene.info" 2> /dev/null | ||
| 430 | -chmod "${_ONLYREAD_PERM}" "${version_install_dir}""/share/info/${ops_base_platform_dir}/version.info" 2> /dev/null | ||
| 431 | -chmod "${_ONLYREAD_PERM}" "${version_install_dir}""/opp/version.info" 2> /dev/null | ||
| 432 | - | ||
| 433 | if [ "${is_change_dir_mode}" = "true" ]; then | 413 | if [ "${is_change_dir_mode}" = "true" ]; then |
| 434 | chmod u-w "${version_install_dir}" 2> /dev/null | 414 | chmod u-w "${version_install_dir}" 2> /dev/null |
| 435 | fi | 415 | fi |
| @@ -189,7 +189,7 @@ updatefeatureandchipinfo() { | |||
| 189 | else | 189 | else |
| 190 | echo "${_key_val}=${_val}" > "${_target_install_dir}" | 190 | echo "${_key_val}=${_val}" > "${_target_install_dir}" |
| 191 | fi | 191 | fi |
| 192 | - | 192 | + |
| 193 | chmod 644 "${_target_install_dir}" 2> /dev/null | 193 | chmod 644 "${_target_install_dir}" 2> /dev/null |
| 194 | } | 194 | } |
| 195 | 195 | ||
| @@ -509,49 +509,8 @@ sh "${_COMMON_PARSER_FILE}" --package="${ops_base_platform_dir}" --install --use | |||
| 509 | --version=${pkg_version} --version-dir=$pkg_version_dir $upgrade_option ${in_install_for_all} ${in_feature_1} ${chip_type_1} "${install_type}" "${_TARGET_INSTALL_PATH}" "${_FILELIST_FILE}" | 509 | --version=${pkg_version} --version-dir=$pkg_version_dir $upgrade_option ${in_install_for_all} ${in_feature_1} ${chip_type_1} "${install_type}" "${_TARGET_INSTALL_PATH}" "${_FILELIST_FILE}" |
| 510 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Install opbase module files failed." | 510 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Install opbase module files failed." |
| 511 | logandprint "[INFO]: upgradePercentage:50%" | 511 | logandprint "[INFO]: upgradePercentage:50%" |
| 512 | - | ||
| 513 | -# change installed folder's permission except aicpu | ||
| 514 | -if [ -f "${install_version_dir}/share/info/${ops_base_platform_dir}" ]; then | ||
| 515 | - subdirs_info=$(ls "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null) | ||
| 516 | - for dir in ${subdirs_info}; do | ||
| 517 | - if [ "${dir}" != "Ascend310" ] && [ "${dir}" != "Ascend310RC" ] && [ "${dir}" != "Ascend910" ] && [ "${dir}" != "Ascend310P" ] && [ "${dir}" != "Ascend" ] && [ "${dir}" != "aicpu" ] && [ "${dir}" != "script" ]; then | ||
| 518 | - chmod -R "${_CUSTOM_PERM}" "${install_version_dir}/opbase/${dir}" 2> /dev/null | ||
| 519 | - fi | ||
| 520 | - done | ||
| 521 | - chmod "${_CUSTOM_PERM}" "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null | ||
| 522 | - logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${UPGRADE_FAILED};ERR_DES:Uninstall the \ | ||
| 523 | - installed directory (${install_version_dir}) failed." | ||
| 524 | -fi | ||
| 525 | - | ||
| 526 | logandprint "[INFO]: Update the opbase install info." | 512 | logandprint "[INFO]: Update the opbase install info." |
| 527 | 513 | ||
| 528 | -# change installed folder's permission except aicpu | ||
| 529 | -subdirs=$(ls "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null) | ||
| 530 | -for dir in ${subdirs}; do | ||
| 531 | - if [ "${dir}" != "vendors" ] && [ "${dir}" != "Ascend310" ] && [ "${dir}" != "Ascend310RC" ] && [ "${dir}" != "Ascend910" ] && [ "${dir}" != "Ascend310P" ] && [ "${dir}" != "Ascend" ] && [ "${dir}" != "aicpu" ] && [ "${dir}" != "script" ] && [ "${dir}" != "static_kernel" ]; then | ||
| 532 | - chmod -R "${_BUILTIN_PERM}" "${install_version_dir}/share/info/${ops_base_platform_dir}/${dir}" 2> /dev/null | ||
| 533 | - fi | ||
| 534 | -done | ||
| 535 | - | ||
| 536 | -if [ "$(id -u)" = "0" ]; then | ||
| 537 | - chmod "755" "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null | ||
| 538 | -else | ||
| 539 | - chmod "${_BUILTIN_PERM}" "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null | ||
| 540 | -fi | ||
| 541 | - | ||
| 542 | -vendor_dir=$(ls "${install_version_dir}/share/info/${ops_base_platform_dir}/vendors" 2> /dev/null) | ||
| 543 | -if [ -d "$vendor_dir" ]; then | ||
| 544 | - chmod -R "${_CUSTOM_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/vendors/$vendor_dir/framework/" 2> /dev/null | ||
| 545 | - chmod -R "${_CUSTOM_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/vendors/$vendor_dir/fusion_pass/" 2> /dev/null | ||
| 546 | - chmod -R "${_CUSTOM_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/vendors/$vendor_dir/fusion_rules/" 2> /dev/null | ||
| 547 | - chmod -R "${_CUSTOM_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/vendors/$vendor_dir/op_impl/" 2> /dev/null | ||
| 548 | - chmod -R "${_CUSTOM_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/vendors/$vendor_dir/op_proto/" 2> /dev/null | ||
| 549 | -fi | ||
| 550 | -chmod "${_ONLYREAD_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/scene.info" 2> /dev/null | ||
| 551 | -chmod "${_ONLYREAD_PERM}" "${install_version_dir}""/share/info/${ops_base_platform_dir}/version.info" 2> /dev/null | ||
| 552 | -chmod "${_ONLYREAD_PERM}" "${install_version_dir}""/opp/version.info" 2> /dev/null | ||
| 553 | -chmod 644 "${install_version_dir}""/share/info/${ops_base_platform_dir}/ascend_install.info" 2> /dev/null | ||
| 554 | - | ||
| 555 | if [ "${is_change_dir_mode}" = "true" ]; then | 514 | if [ "${is_change_dir_mode}" = "true" ]; then |
| 556 | chmod u-w "${_TARGET_INSTALL_PATH}" 2> /dev/null | 515 | chmod u-w "${_TARGET_INSTALL_PATH}" 2> /dev/null |
| 557 | fi | 516 | fi |
| @@ -566,11 +525,6 @@ done | |||
| 566 | chown "${_TARGET_USERNAME}":"${_TARGET_USERGROUP}" "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null | 525 | chown "${_TARGET_USERNAME}":"${_TARGET_USERGROUP}" "${install_version_dir}/share/info/${ops_base_platform_dir}" 2> /dev/null |
| 567 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Change opbase onwership failed.." | 526 | logwitherrorlevel "$?" "error" "[ERROR]: ERR_NO:${INSTALL_FAILED};ERR_DES:Change opbase onwership failed.." |
| 568 | 527 | ||
| 569 | -#chmod to support copy | ||
| 570 | -if [ -d "${install_version_dir}/share/info/${ops_base_platform_dir}/vendors" ] && [ "$(id -u)" != "0" ]; then | ||
| 571 | - chmod -R "${_CUSTOM_PERM}" ${install_version_dir}/share/info/${ops_base_platform_dir}/vendors | ||
| 572 | -fi | ||
| 573 | - | ||
| 574 | # create softlinks for stub libs in devlib/linux/$(ARCH) | 528 | # create softlinks for stub libs in devlib/linux/$(ARCH) |
| 575 | create_stub_softlink "${install_version_dir}" | 529 | create_stub_softlink "${install_version_dir}" |
| 576 | 530 | ||
🔴 Critical
changed line:本 diff 在 install.sh 中删除了
if [ $(id -u) -eq 0 ]的 else 分支(else+ 两行 chmod)及其收尾的fi(旧行 1535-1538),但没有补回该fi。affected behavior/contract:删除后第 1530 行
if [ $(id -u) -eq 0 ]; then到第 1533 行logoperationretstatus之间失去闭合的fi,第 1534 行唯一剩余的fi现在闭合的是 1530 行的 if,而原本由该fi闭合的if [ "${is_install}" = "y" ]; then(第 1412 行)在整个文件中再无对应fi——后续 1562/1590/1595 行的fi分别闭合 1536/1564/1592 行的 if,第 1412 行的 if 一直悬空到 EOF。全文件统计:1412-1597 区间内if ... then共 28 个、fi仅 27 个。failure mode:bash 解析整个脚本到 EOF 时发现未闭合的 if,报
syntax error: unexpected end of file(可用bash -n复现),install.sh 整体无法解析执行,所有经该入口的安装/升级/卸载流程(包括它调用的 opp_install.sh/opp_upgrade.sh)全部失效,属 P0 级破坏。secondary defect(同一根因):即便补回
fi,若只把fi加在 logoperationretstatus 之后,logoperationretstatus 会被框进 root-only 分支,非 root 安装将跳过操作日志记录与退出码处理(且第 1533 行$?取的是 chown 的返回值而非安装结果);与基线一致的正确形态是让 logoperationretstatus 位于if [ $(id -u) -eq 0 ]之外、if [ "${is_install}" = "y" ]块之内。suggested fix:在 chown 两行之后补回
fi闭合 1530 行的 if,并保持 logoperationretstatus 位于 if 之外(即恢复基线结构:else 分支删除后 if/else 变为单独 if,但闭合 fi 必须保留)。建议:在 chown 两行之后补回一个
fi闭合if [ $(id -u) -eq 0 ],并让logoperationretstatus保持在该 if 之外、if [ "${is_install}" = "y" ]块之内(与基线一致)。