rpmbuild时报告Package already exists: %package ...错误的可能原因

用 rpmbuild 编译一些老的 SRPM 或 tarball 时经常会报告 Package already exists: %package ... 错误而无法继续,通常其原因是这些包的 spec 文件中含有当前版本的 rpmbuild 无法识别或展开的宏定义,只要修改一下 spec 文件保证其中非标准的宏都有对应定义应该就能继续打包了。

 

# rpmrebuild autogenerated specfile %define defaultbuildroot / AutoProv: no %undefine __find_provides AutoReq: no %undefine __find_requires # Do not try autogenerate prereq/conflicts/obsoletes and check files %undefine __check_files %undefine __find_prereq %undefine __find_conflicts %undefine __find_obsoletes # Be sure buildpolicy set to do nothing %define __spec_install_post %{nil} # Something that need for rpm-4.1 %define _missing_doc_files_terminate_build 0 #dummy #dummy #BUILDHOST: k8s-node113 #BUILDTIME: Thu 03 Jul 2025 06:06:54 PM CST #SOURCERPM: UBEngine-mami-1.0.0.0.b007-rtos208.8.0.src.rpm #RPMVERSION: 4.14.1 #COOKIE: k8s-node113 1751537214 #OS: linux #SIZE: 11140365 #ARCHIVESIZE: 11158404 #ARCH: aarch64 BuildArch: aarch64 Name: UBEngine-mami Version: 1.0.0.0.b007 Release: rtos208.8.0 License: Copyright (C) Huawei Technologies Co., Ltd. 2025-2030. All rights reserved. Group: Unspecified Summary: ubengine rpm Package URL: N/A Prefix: / Provides: UBEngine-mami = 1.0.0.0.b007-rtos208.8.0 Provides: UBEngine-mami(aarch-64) = 1.0.0.0.b007-rtos208.8.0 Requires(pre): /bin/sh Requires(post): /bin/sh Requires(preun): /bin/sh Requires(postun): /bin/sh #Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 #Requires: rpmlib(FileDigests) <= 4.6.0-1 #Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 %description This package contains the ubengine rpm rtos. %files %dir %attr(0755, root, root) "/etc/mdc" %dir %attr(0755, root, root) "/etc/mdc/base-plat" %dir %attr(0550, root, root) "/etc/mdc/base-plat/aosservice" %attr(0440, root, root) "/etc/mdc/base-plat/aosservice/IAM_server_startup.yaml" %dir %attr(0550, root, root) "/etc/mdc/base-plat/process-manager" %attr(0440, root, root) "/etc/mdc/base-plat/process-manager/baseService.yaml" %attr(0444, root, root) "/etc/mdc/base-plat/process-manager/bin_hash.cfg" %attr(0440, root, root) "/etc/mdc/base-plat/process-manager/procmgr_cfg.yaml" %attr(0440, root, root) "/etc/mdc/base-plat/process-manager/startup_procmgr.yaml" %dir %attr(0555, root, root) "/etc/mdc/base-plat/resconfig" %attr(0444, root, root) "/etc/mdc/base-plat/resconfig/resource_config.fc" %attr(0440, root, root) "/etc/mdc/sstoowner_vfs_cfg.yaml" %attr(0444, root, root) "/lib64/libgroup_client.so" %attr(0444, root, root) "/lib64/libgroup_owner.so" %attr(0444, root, root) "/lib64/libparse_depend.so" %attr(0444, root, root) "/lib64/libsstoowner.so" %attr(0444, root, root) "/lib64/libunified_timer.so" %dir %attr(0755, root, root) "/usr/bin/mdc" %dir %attr(0755, root, root) "/usr/bin/mdc/base-plat" %dir %attr(0755, root, root) "/usr/bin/mdc/base-plat/aosservice" %attr(0550, root, root) "/usr/bin/mdc/base-plat/aosservice/iammgr" %dir %attr(0755, root, root) "/usr/bin/mdc/base-plat/process-manager" %attr(0550, root, root) "/usr/bin/mdc/base-plat/process-manager/process-manager" %dir %attr(0755, root, root) "/usr/lib/systemd/system" %attr(0640, root, root) "/usr/lib/systemd/system/ubcm.service" %attr(0777, root, root) "/usr/lib64/libeasy_comm.so" %attr(0444, root, root) "/usr/lib64/libeasy_comm.so.0.1.0.0" %attr(0777, root, root) "/usr/lib64/libeasy_comm.so.1" %attr(0444, root, root) "/usr/lib64/libheartbeat.so" %attr(0777, root, root) "/usr/lib64/libiam.so" %attr(0444, root, root) "/usr/lib64/libiam.so.0.1.0.0" %attr(0777, root, root) "/usr/lib64/libiam.so.1" %attr(0444, root, root) "/usr/lib64/libpfstat_base.so" %attr(0777, root, root) "/usr/lib64/libxshmem.so" %attr(0777, root, root) "/usr/lib64/libxshmem.so.1" %attr(0444, root, root) "/usr/lib64/libxshmem.so.1.3.0.1" %attr(0777, root, root) "/usr/lib64/libyaml-0.so.2" %attr(0444, root, root) "/usr/lib64/libyaml-0.so.2.0.9" %attr(0777, root, root) "/usr/lib64/libyaml.so" %dir %attr(0755, root, root) "/usr/local/include/mami" %dir %attr(0755, root, root) "/usr/local/include/mami/mamiapi" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_acl.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_api.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_def.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_devm.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_drm.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_errno.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_event.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_ipc.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_irt.h" %attr(0755, root, root) "/usr/local/include/mami/mamiapi/mami_linkcom.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_nl.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_port.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_qos.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_route.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_tpl.h" %attr(0444, root, root) "/usr/local/include/mami/mamiapi/mami_ubmem.h" %dir %attr(0755, root, root) "/usr/local/lib64/mami" %attr(0777, root, root) "/usr/local/lib64/mami/libascend_protobuf.so" %attr(0444, root, root) "/usr/local/lib64/mami/libascend_protobuf.so.3.13.0.0" %attr(0444, root, root) "/usr/local/lib64/mami/libbase_module.so" %attr(0444, root, root) "/usr/local/lib64/mami/libc_sec.so" %attr(0444, root, root) "/usr/local/lib64/mami/libmami.so" %attr(0444, root, root) "/usr/local/lib64/mami/libmami_route_mng.so" %attr(0444, root, root) "/usr/local/lib64/mami/libmami_route_tbl_cfg.so" %dir %attr(0755, root, root) "/usr/local/lib64/mami/module" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubacl.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ublinkcom.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubmdrm.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubmem.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubmirt.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubnl.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubport.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubqos.so" %attr(0444, root, root) "/usr/local/lib64/mami/module/libmami_ubtpl.so" %dir %attr(0755, root, root) "/usr/local/mami" %dir %attr(0755, root, root) "/usr/local/mami/conf" %attr(0444, root, root) "/usr/local/mami/conf/mami_dev_ctrl.yaml" %attr(0444, root, root) "/usr/local/mami/conf/mami_dev_mng.yaml" %attr(0644, root, root) "/usr/local/mami/conf/mami_user.yaml" %attr(0444, root, root) "/usr/local/mami/drv_auth.ko" %attr(0444, root, root) "/usr/local/mami/drv_xshmem.ko" %attr(0550, root, root) "/usr/local/mami/mami_dev_ctrl.bin" %attr(0550, root, root) "/usr/local/mami/mami_dev_mng.bin" %attr(0400, root, root) "/usr/local/mami/mami_linkcom.ko" %attr(0400, root, root) "/usr/local/mami/mami_mctrlq.ko" %attr(0550, root, root) "/usr/local/mami/mami_sys_init.sh" %attr(0400, root, root) "/usr/local/mami/mami_ubdevm.ko" %attr(0400, root, root) "/usr/local/mami/mami_ubfabric.ko" %dir %attr(0755, root, root) "/usr/local/mami/script" %attr(0550, root, root) "/usr/local/mami/script/check_version_required.awk" %attr(0550, root, root) "/usr/local/mami/script/cleanup.sh" %attr(0550, root, root) "/usr/local/mami/script/common_func.inc" %attr(0550, root, root) "/usr/local/mami/script/common_func_v2.inc" %attr(0550, root, root) "/usr/local/mami/script/common_func_v3.inc" %attr(0550, root, root) "/usr/local/mami/script/common_installer.inc" %attr(0550, root, root) "/usr/local/mami/script/common_interface.bash" %attr(0550, root, root) "/usr/local/mami/script/common_interface.csh" %attr(0550, root, root) "/usr/local/mami/script/common_interface.fish" %attr(0550, root, root) "/usr/local/mami/script/filelist.csv" %attr(0550, root, root) "/usr/local/mami/script/help.info" %attr(0550, root, root) "/usr/local/mami/script/install_common_parser.sh" %attr(0550, root, root) "/usr/local/mami/script/mami_common_func.inc" %attr(0550, root, root) "/usr/local/mami/script/multi_version.inc" %attr(0550, root, root) "/usr/local/mami/script/rpm_post_opt.sh" %attr(0550, root, root) "/usr/local/mami/script/rpm_preun_opt.sh" %attr(0550, root, root) "/usr/local/mami/script/rpm_start.sh" %attr(0550, root, root) "/usr/local/mami/script/run_install.sh" %attr(0550, root, root) "/usr/local/mami/script/run_start.sh" %attr(0550, root, root) "/usr/local/mami/script/run_uninstall.sh" %attr(0550, root, root) "/usr/local/mami/script/script_operator.inc" %attr(0550, root, root) "/usr/local/mami/script/start_mami.sh" %attr(0550, root, root) "/usr/local/mami/script/stop_mami.sh" %attr(0550, root, root) "/usr/local/mami/script/ube_config_user.sh" %attr(0550, root, root) "/usr/local/mami/script/version_cfg.inc" %attr(0550, root, root) "/usr/local/mami/script/version_compatiable.inc" %dir %attr(0755, root, root) "/usr/share/doc/UBEngine-mami-1.0.0.0.b007" %doc %attr(0664, root, root) "/usr/share/doc/UBEngine-mami-1.0.0.0.b007/mami.spec" %pre -p /bin/sh #!/bin/bash opt_val="$1" mami_user_name=ubeUser mami_group_name=ubeUser mami_user_id=1201 mami_group_id=1201 user_bin_paths=() # 支持的config配置最大值 expected_config_max=10 mami_log() { local cur_date="$(date +'%%Y-%%m-%%d %%H:%%M:%%S')" local log_type="$1" local log_msg="$2" local log_format="[MAMI] [$cur_date] [$log_type]: $log_msg" if [ "$log_type" = "INFO" ]; then echo "$log_format" elif [ "$log_type" = "WARNING" ]; then echo "$log_format" elif [ "$log_type" = "ERROR" ]; then echo "$log_format" fi } check_root() { mami_log "INFO" "Start to check the execution script permission." current_user=$(whoami) if [[ "$current_user" != "root" ]]; then mami_log "ERROR" "This script must be run as root." return 1 fi mami_log "INFO" "Finish the script execution permission check." return $? } check_user_group() { group_info=$(getent group "${mami_group_name}") if [ -z "${group_info}" ]; then mami_log "ERROR" "Group ${mami_group_name} does not exists." return 1 fi actual_group_id=$(echo "$group_info" | cut -d: -f3) if [ "${actual_group_id}" -ne "${mami_group_id}" ]; then mami_log "ERROR" "Check failed, acutal gid is ${actual_group_id}, expected gid is ${mami_group_id}" return 1 fi user_info=$(getent passwd "${mami_user_name}") if [ -z "${user_info}" ]; then mami_log "ERROR" "Check failed, user ${mami_user_name} does not exists." return 1 fi actual_user_id=$(echo "$user_info" | cut -d: -f3) actual_user_gid=$(echo "$user_info" | cut -d: -f4) if [ "${actual_user_id}" -ne "${mami_user_id}" ]; then mami_log "ERROR" "Check failed, acutal uid is ${actual_user_id}, expected uid is ${mami_user_id}." return 1 fi if [ "${actual_user_gid}" -ne "${mami_group_id}" ]; then mami_log "ERROR" "Check failed, expected gid of ${mami_user_name} is ${mami_group_id}, but actual gid is ${actual_user_gid}." return 1 fi mami_log "INFO" "Check user and group successfully." return 0 } add_mami_user_and_group() { mami_log "INFO" "Start to add mami user and group." existing_group_info=$(getent group "${mami_group_name}") if [ -n "${existing_group_info}" ]; then existing_group_id=$(echo "${existing_group_info}" | cut -d: -f3) if [ "${existing_group_id}" -eq "${mami_group_id}" ]; then mami_log "INFO" "Group ${mami_group_name} already exists, and gid matched, no need create group." else mami_log "ERROR" "Group ${mami_group_name} already exists, but gid is ${existing_group_id}, expected gid is ${mami_group_id}." return 1 fi else if getent group "${mami_group_id}" > /dev/null 2>&1; then mami_log "ERROR" "Group id ${mami_group_id} already exists." return 1 fi mami_log "INFO" "Add group ${mami_group_name} with gid ${mami_group_id}." groupadd -g ${mami_group_id} ${mami_group_name} 2> /dev/null if [ $? -ne 0 ]; then mami_log "ERROR" "Add group ${mami_group_name} with gid ${mami_group_id} failed." return 1 fi fi existing_user_info=$(getent passwd "${mami_user_name}") if [ -n "${existing_user_info}" ]; then existing_user_id=$(echo "${existing_user_info}" | cut -d: -f3) existing_user_gid=$(echo "${existing_user_info}" | cut -d: -f4) if [ "${existing_user_id}" -eq "${mami_user_id}" ]; then mami_log "INFO" "User ${mami_user_name} already exists, and uid ${mami_user_id} matched." if [ "${existing_user_gid}" -ne "${mami_group_id}" ]; then mami_log "ERROR" "Current gid of user ${mami_user_name} is ${existing_user_gid}, expected gid is ${mami_group_id}." return 1 fi else mami_log "ERROR" "Current user ${mami_user_name} already exists, but uid is ${existing_user_id}, expected uid is ${mami_user_id}." return 1 fi else if getent passwd "${mami_user_id}" > /dev/null 2>&1; then mami_log "ERROR" "Uid ${mami_user_id} already exists." return 1 fi mami_log "INFO" "Add user ${mami_user_name} with uid ${mami_user_id}." useradd -u ${mami_user_id} -g ${mami_group_name} -m ${mami_user_name} 2> /dev/null if [ $? -ne 0 ]; then mami_log "ERROR" "Add user ${mami_user_name} with uid ${mami_user_id} failed." return 1 fi fi usermod -aG ${mami_group_name} ${mami_user_name} if [ $? -ne 0 ]; then mami_log "ERROR" "Add user [ ${mami_user_name} ] to group [ ${mami_group_name} ] failed." return 1 fi check_user_group if [ $? -ne 0 ]; then mami_log "ERROR" "Check mami user and group failed." return 1 fi mami_log "INFO" "Finish adding mami user and group." return 0 } stop_mami() { local mami_stop_file="/usr/local/mami/script/stop_mami.sh" if [ ! -f "${mami_stop_file}" ]; then mami_log "ERROR" "Mami stop file ${mami_stop_file} does not exist, please check install process. Or you can find stop_mami.sh after decompress mami package with rpm2cpio tools, then you can execute it maunally." return 1 fi mami_log "WARNING" "Important : Please execute [ "${mami_stop_file}" ] to stop mami firstly." return $? } # ipc模块的检查 check_mami_dev_ctrl_process() { if ps -ef | grep -v grep | grep "mami_dev_ctrl.bin" > /dev/null; then mami_log "ERROR" "File mami_dev_ctrl.bin is in use. The options are as follows: 1. Stop the user application: stop the management of any device through the mamiDestroyDevice api. 2. If there is no user application, stop the processes related to mami_dev_ctrl.bin manually." return 1 fi return $? } # 设备管理模块的检查 check_mami_dev_mng_process() { if ps -ef | grep -v grep | grep "mami_dev_mng.bin" > /dev/null; then mami_log "ERROR" "File of mami_dev_mng.bin is in use." stop_mami if [ $? -ne 0 ]; then mami_log "ERROR" "Call stop mami func failed." fi return 1 fi return $? } # 检查是否存在已经被加载的ko check_installed_mami_ko_module() { local mami_kernel_modules="mami_mctrlq mami_linkcom mami_ubdevm mami_ubfabric drv_auth drv_xshmem" local kern_module="" for kern_module in ${mami_kernel_modules} do if lsmod | grep -wq ${kern_module}; then mami_log "ERROR" "Mami ko [${kern_module}] is loaded, please unload it firstly." return 1 fi done return $? } # 不能卸载,或者覆盖安装的预检查 pre_check_uninstall_or_install() { check_mami_dev_ctrl_process if [ $? -ne 0 ]; then return 1 fi check_mami_dev_mng_process if [ $? -ne 0 ]; then return 1 fi # 检查是否有基础进程存在 if (ps -ef | grep -v grep | grep process-manager/process-manager > /dev/null) || (ps -ef | grep -v grep | grep iammgr > /dev/null); then mami_log "ERROR" "Mami base process exists. Perform operations as warning prompted." stop_mami if [ $? -ne 0 ]; then mami_log "ERROR" "Call stop mami func failed." fi return 1 fi check_installed_mami_ko_module if [ $? -ne 0 ]; then mami_log "ERROR" "Mami kernel module is loaded. Perform operations as warning prompted." stop_mami if [ $? -ne 0 ]; then mami_log "ERROR" "Call stop mami func failed." fi return 1 fi # 如果有其他检查,在这里新增 return $? } # 安装前调用该函数,校验用户bin路径是否合理 check_config_path_common() { local input="$@" mami_log "INFO" "User input path : ${input}" # 检查个数 IFS=',' read -r -a user_bin_paths <<< "$input" actual_length=${#user_bin_paths[@]} if [ $actual_length -gt $expected_config_max ] || [ $actual_length -lt 1 ]; then mami_log "ERROR" "Value in MAMI_USER_BIN_PATHS expected [1,$expected_config_max] elements, but got $actual_length." return 1 fi # 检查是否重复 declare -A seen_paths for path in "${user_bin_paths[@]}"; do mami_log "INFO" "User bin path : $path" # 检查是否有重复路径 if [[ -n "${seen_paths[$path]}" ]]; then mami_log "ERROR" "Duplicate path found: $path, please check your input value in MAMI_USER_BIN_PATHS." return 1 fi seen_paths[$path]=1 done return $? } check_config_path() { if [ x"${MAMI_USER_BIN_PATHS}" = "x" ]; then mami_log "WARNING" "Important Tips : No user bin path is configured. If your app stated with a bin file, please use [ export MAMI_USER_BIN_PATHS=/yourpath ] to configure your bin path." return 0 fi local config_values=${MAMI_USER_BIN_PATHS} check_config_path_common "${config_values}" if [ $? -ne 0 ]; then mami_log "ERROR" "Check user bin path failed." return 1 fi return $? } pre_operations_main() { check_root if [ $? -ne 0 ]; then mami_log "ERROR" "Permission denied." return 1 fi pre_check_uninstall_or_install if [ $? -ne 0 ]; then mami_log "ERROR" "Pre check before install failed." return 1 fi check_config_path if [ $? -ne 0 ]; then mami_log "ERROR" "Check user bin path configuration failed." return 1 fi # 1-安装,2-升级 if [ "${opt_val}" -eq 1 ]; then mami_log "INFO" "Pre-operations before install." add_mami_user_and_group if [ $? -ne 0 ]; then mami_log "ERROR" "Add mami user and group failed." return 1 fi elif [ "${opt_val}" -eq 2 ]; then mami_log "INFO" "Pre-operations before upgrade." fi mami_log "INFO" "Pre-operations before install successfully." return $? } # %%pre主逻辑调用 mami_log "INFO" "Pre-operations %%pre begin." pre_operations_main if [ $? -ne 0 ]; then mami_log "ERROR" "Pre-operations %%pre failed." exit 1 fi mami_log "INFO" "Pre-operations %%pre successfully." ####################################### %%post ####################################### # 安装、升级之后执行 %post -p /bin/sh source /usr/local/mami/script/rpm_post_opt.sh ####################################### %%preun ####################################### # 卸载、升级之前执行 %preun -p /bin/sh #!/bin/bash source /usr/local/mami/script/rpm_preun_opt.sh "$1" ####################################### %%postun ####################################### # 卸载、升级之后执行 %postun -p /bin/sh #!/bin/bash opt_val="$1" # 错误记录标记 error_flag=0 mami_user_name=ubeUser mami_group_name=ubeUser mami_log() { local cur_date="$(date +'%%Y-%%m-%%d %%H:%%M:%%S')" local log_type="$1" local log_msg="$2" local log_format="[MAMI] [$cur_date] [$log_type]: $log_msg" if [ "$log_type" = "INFO" ]; then echo "$log_format" elif [ "$log_type" = "WARNING" ]; then echo "$log_format" elif [ "$log_type" = "ERROR" ]; then echo "$log_format" fi } uninstall_post_check() { # 卸载后处理 local iam_pm_conf_dir="/etc/mdc" local iam_pm_bin_dir="/usr/bin/mdc" local mami_base_dir="/usr/local/mami" local mami_include_dir="/usr/local/include/mami" local mami_so_dir="/usr/local/lib64/mami" if [ -d "${iam_pm_conf_dir}" ]; then if ! rm -rf "${iam_pm_conf_dir}"; then mami_log "ERROR" "Non-fatal error, Delete the iam&pm conf file directory failed, please try to delete ${iam_pm_conf_dir} manually." error_flag=1 fi mami_log "INFO" "Delete the iam&pm conf file directory successfully." fi if [ -d "${iam_pm_bin_dir}" ]; then if ! rm -rf "${iam_pm_bin_dir}"; then mami_log "ERROR" "Non-fatal error, Delete the iam&pm bin file directory failed, please try to delete ${iam_pm_bin_dir} manually." error_flag=1 fi mami_log "INFO" "Delete the iam&pm bin file directory successfully." fi if [ -d "${mami_base_dir}" ]; then if ! rm -rf "${mami_base_dir}"; then mami_log "ERROR" "Non-fatal error, Delete the mami base directory failed, please try to delete ${mami_base_dir} manually." error_flag=1 fi mami_log "INFO" "Delete the mami base directory successfully." fi if [ -d "${mami_include_dir}" ]; then if ! rm -rf "${mami_include_dir}"; then mami_log "ERROR" "Non-fatal error, Delete the mami include directory failed, please try to delete ${mami_include_dir} manually." error_flag=1 fi mami_log "INFO" "Delete the mami include directory successfully." fi if [ -d "${mami_so_dir}" ]; then if ! rm -rf "${mami_so_dir}"; then mami_log "ERROR" "Non-fatal error, Delete the mami so directory failed, please try to delete ${mami_so_dir} manually." error_flag=1 fi mami_log "INFO" "Delete the mami so directory successfully." fi return $? } delete_mami_user() { mami_log "INFO" "Start to remove mami user and group." if id "${mami_user_name}" &>/dev/null; then if userdel -r "${mami_user_name}"; then mami_log "INFO" "Delete user ${mami_user_name} successfully." else mami_log "ERROR" "Delete user ${mami_user_name} failed." error_flag=1 fi else mami_log "INFO" "User ${mami_user_name} does not exists, no need to delete." fi if getent group ${mami_group_name} &>/dev/null; then if groupdel "${mami_group_name}"; then mami_log "INFO" "Delete group ${mami_group_name} successfully." else mami_log "ERROR" "Delete group ${mami_group_name} failed." error_flag=1 fi else mami_log "INFO" "Group ${mami_group_name} does not exists, no need to delete." fi return $? } postun_uninstall() { # 卸载后处理 # 删除ubeUser组和用户 delete_mami_user if [ $? -ne 0 ]; then mami_log "ERROR" "Delete user:[${mami_user_name}] or group:[${mami_group_name}] failed, please delete it manually." error_flag=1 fi # 删除残留文件 uninstall_post_check if [ $? -ne 0 ]; then mami_log "ERROR" "Post check for uninstall failed." error_flag=1 fi return $? } postun_operations_main() { # 0-卸载,1-升级 if [ "${opt_val}" -eq 0 ]; then mami_log "INFO" "Postun-operations uninstall." postun_uninstall if [ $? -ne 0 ]; then mami_log "ERROR" "Postun-operations %%postun failed." return 1 fi elif [ "${opt_val}" -eq 1 ]; then mami_log "INFO" "Postun-operations upgrade." fi return $? } # %%postun主逻辑调用 mami_log "INFO" "Postun-operations %%postun begin." postun_operations_main if [ $? -ne 0 ] || [ ${error_flag} -ne 0 ]; then mami_log "ERROR" "Postun-operations %%postun failed." exit 1 fi mami_log "INFO" "Postun-operations %%postun successfully." %changelog 根据这个,我应该把文件放在哪里
最新发布
07-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值