已合并
[msprof]msprof的run包增加--uninstall参数 #84
yuliangbin创建于 2月26日
[msprof]msprof的run包增加--uninstall参数 #84
已合并
yuliangbin创建于 2月26日
8 个文件变更+261-154
Mdocs/zh/msprof_install_guide.md+5-4
@@ -134,10 +134,11 @@ msProf工具run包的编译命令可配置如下参数。
134 134 
135msProf工具run包的安装命令可配置如下参数。135msProf工具run包的安装命令可配置如下参数。
136 136 
137| 参数 | 可选/必选 | 说明 |137| 参数 | 可选/必选 | 说明 |
138| --------| ------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------|138| --------| ------- |------------------------------------------------------------------------------------------------------------------------------------------------|
139| --install | 选 | 安装软件包。可配置--install-path参数指定软件的安装路径;不配置--install-path参数时,则直接安装到默认路径下。 |139| --install | 选 | 安装软件包。可配置--install-path参数指定软件的安装路径;不配置--install-path参数时,则直接安装到默认路径下。 |
140| --uninstall | 可选 | 卸载软件包。可配置--install-path参数指定软件安装时的路径;不配置--install-path参数时,则直接卸载默认路径下的msprof。 |
140| --install-path | 可选 | 安装路径。路径须指定到cann目录,如果用户未指定安装路径,则软件会安装到默认路径下,默认安装路径如下:<br>- root用户:`/usr/local/Ascend/cann`<br>- 非root用户:`${HOME}/Ascend/cann`,${HOME}为当前用户的家目录。 |141| --install-path | 可选 | 安装路径。路径须指定到cann目录,如果用户未指定安装路径,则软件会安装到默认路径下,默认安装路径如下:<br>- root用户:`/usr/local/Ascend/cann`<br>- 非root用户:`${HOME}/Ascend/cann`,${HOME}为当前用户的家目录。 |
141| --install-for-all | 可选 | 安装时,允许其他用户具有安装用户组的权限。当安装携带该参数时,支持其他用户使用msProf运行业务,但该参数存在安全风险,请谨慎使用。 |142| --install-for-all | 可选 | 安装时,允许其他用户具有安装用户组的权限。当安装携带该参数时,支持其他用户使用msProf运行业务,但该参数存在安全风险,请谨慎使用。 |
142 143 
143安装run包还可指定其他参数,具体可通过./xxx.run --help命令查看。144安装run包还可指定其他参数,具体可通过./xxx.run --help命令查看。
Mscripts/create_run_package.sh+3-0
@@ -25,6 +25,7 @@ RUN_SCRIPT_DIR=${TOP_DIR}/scripts/run_script
25FILTER_PARAM_SCRIPT=${RUN_SCRIPT_DIR}/help.conf25FILTER_PARAM_SCRIPT=${RUN_SCRIPT_DIR}/help.conf
26MAIN_SCRIPT=main.sh26MAIN_SCRIPT=main.sh
27INSTALL_SCRIPT=install.sh27INSTALL_SCRIPT=install.sh
28UN_INSTALL_SCRIPT=uninstall.sh
28UTILS_SCRIPT=utils.sh29UTILS_SCRIPT=utils.sh
29 30 
30MSPROF_RUN_NAME="mindstudio-profiler"31MSPROF_RUN_NAME="mindstudio-profiler"
@@ -100,6 +101,7 @@ function create_temp_dir() {
100 101 
101 copy_script ${MAIN_SCRIPT} ${temp_dir}102 copy_script ${MAIN_SCRIPT} ${temp_dir}
102 copy_script ${INSTALL_SCRIPT} ${temp_dir}103 copy_script ${INSTALL_SCRIPT} ${temp_dir}
104 copy_script ${UN_INSTALL_SCRIPT} ${temp_dir}
103 copy_script ${UTILS_SCRIPT} ${temp_dir}105 copy_script ${UTILS_SCRIPT} ${temp_dir}
104}106}
105 107 
@@ -215,6 +217,7 @@ function check_file_exist() {
215 217 
216 check_package ${temp_dir}/${MAIN_SCRIPT}218 check_package ${temp_dir}/${MAIN_SCRIPT}
217 check_package ${temp_dir}/${INSTALL_SCRIPT} ${PKG_LIMIT_SIZE}219 check_package ${temp_dir}/${INSTALL_SCRIPT} ${PKG_LIMIT_SIZE}
220 check_package ${temp_dir}/${UN_INSTALL_SCRIPT} ${PKG_LIMIT_SIZE}
218 check_package ${temp_dir}/${UTILS_SCRIPT} ${PKG_LIMIT_SIZE}221 check_package ${temp_dir}/${UTILS_SCRIPT} ${PKG_LIMIT_SIZE}
219}222}
220 223 
Mscripts/run_script/help.conf+3-1
@@ -1,3 +1,5 @@
1 --install Install1 --install Install
2 --install-path=<path> Install to the specified path2 --install-path=<path> Install to the specified path
3 --install-for-all Install for all users3 --install-for-all Install for all users
4 --uninstall Uninstall
5 --install-path=<path> Uninstall from the specified path
Mscripts/run_script/install.sh+26-2
@@ -39,7 +39,10 @@ function implement_install() {
39 create_directory ${install_path}/${arch_name}/include/acl ${right}39 create_directory ${install_path}/${arch_name}/include/acl ${right}
40 create_directory ${install_path}/${arch_name}/include/ge ${right}40 create_directory ${install_path}/${arch_name}/include/ge ${right}
41 create_directory ${install_path}/${ANALYSIS_PATH} ${right}41 create_directory ${install_path}/${ANALYSIS_PATH} ${right}
42 # 1. install collector42 create_directory ${install_path}/${SHARE_INFO_DIR}/${MSPROF} ${right}
43 # 1. uninstall.sh
44 copy_file ${UNINSTALL_SCRIPT} ${install_path}/${SHARE_INFO_DIR}/${MSPROF}/${UNINSTALL_SCRIPT}
45 # 2. install collector
43 # msprof bin46 # msprof bin
44 copy_file ${MSPROF} ${install_path}/${MSPROF_PATH}/${MSPROF}47 copy_file ${MSPROF} ${install_path}/${MSPROF_PATH}/${MSPROF}
45 # libmsprofiler.so48 # libmsprofiler.so
@@ -53,7 +56,7 @@ function implement_install() {
53 # ge_prof.h56 # ge_prof.h
54 copy_file ${GE_PROF_H} ${install_path}/${arch_name}/include/ge/${GE_PROF_H}57 copy_file ${GE_PROF_H} ${install_path}/${arch_name}/include/ge/${GE_PROF_H}
55 58 
56 # 2. install analyse59 # 3. install analyse
57 copy_file ${ANALYSIS} ${install_path}/${ANALYSIS_PATH}/${ANALYSIS}60 copy_file ${ANALYSIS} ${install_path}/${ANALYSIS_PATH}/${ANALYSIS}
58 msprof_analyse_whl=${install_path}/${ANALYSIS_PATH}/${MSPROF_ANALYSIS_WHL}61 msprof_analyse_whl=${install_path}/${ANALYSIS_PATH}/${MSPROF_ANALYSIS_WHL}
59 copy_file ${MSPROF_ANALYSIS_WHL} $msprof_analyse_whl62 copy_file ${MSPROF_ANALYSIS_WHL} $msprof_analyse_whl
@@ -134,11 +137,32 @@ function chmod_libmsprofiler() {
134 fi137 fi
135}138}
136 139 
140function register_uninstall() {
141 if [ ! -f "${install_path}/${SHARE_INFO_DIR}/${MSPROF}/${UNINSTALL_SCRIPT}" ]; then
142 print "ERROR" "No such file: ${install_path}/${SHARE_INFO_DIR}/${MSPROF}/${UNINSTALL_SCRIPT}"
143 fi
144 if [ ! -x "${install_path}/${SHARE_INFO_DIR}/${MSPROF}/${UNINSTALL_SCRIPT}" ]; then
145 print "ERROR" "The file ${install_path}/${SHARE_INFO_DIR}/${MSPROF}/${UNINSTALL_SCRIPT} is not executable."
146 return 1
147 fi
148 if [ ! -f "${install_path}/${CANN_UNINSTALL_SCRIPT}" ]; then
149 print "ERROR" "Failed to register uninstall script, no such file: ${install_path}/${CANN_UNINSTALL_SCRIPT}"
150 return 1
151 fi
152 local script_right=$(stat -c '%a' "${install_path}/${CANN_UNINSTALL_SCRIPT}")
153 chmod u+w "${install_path}/${CANN_UNINSTALL_SCRIPT}"
154 sed -i "/^exit /i uninstall_package \"share\/info\/msprof\"" "${install_path}/${CANN_UNINSTALL_SCRIPT}"
155 chmod ${script_right} "${install_path}/${CANN_UNINSTALL_SCRIPT}"
156}
157 
137source utils.sh158source utils.sh
138 159 
139right=${user_right}160right=${user_right}
140arch_name="${package_arch}-linux"161arch_name="${package_arch}-linux"
141implement_install162implement_install
163if [ $? -eq 0 ]; then
164 register_uninstall
165fi
142chmod_ini_file166chmod_ini_file
143set_libmsprofiler_right167set_libmsprofiler_right
144chmod_libmsprofiler168chmod_libmsprofiler
Mscripts/run_script/main.sh+27-5
@@ -3,6 +3,7 @@
3install_args_num=03install_args_num=0
4install_path_num=04install_path_num=0
5 5 
6uninstall_flag=0
6install_for_all_flag=07install_for_all_flag=0
7 8 
8function parse_script_args() {9function parse_script_args() {
@@ -29,6 +30,11 @@ function parse_script_args() {
29 shift30 shift
30 continue31 continue
31 ;;32 ;;
33 --uninstall)
34 uninstall_flag=1
35 shift
36 continue
37 ;;
32 --install-for-all)38 --install-for-all)
33 install_for_all_flag=139 install_for_all_flag=1
34 shift40 shift
@@ -43,11 +49,14 @@ function parse_script_args() {
43}49}
44 50 
45function check_args() {51function check_args() {
46 if [ ${install_args_num} -eq 0 ]; then52 if [ ${install_args_num} -ne 0 ] && [ ${uninstall_flag} -eq 1 ]; then
47 print "ERROR" "Input option is invalid. Please try --help."53 print "ERROR" "Input option is invalid. Please try --help."
48 exit 154 exit 1
49 fi55 fi
50 56 if [ ${install_args_num} -eq 0 ] && [ ${uninstall_flag} -eq 0 ]; then
57 print "ERROR" "Input option is invalid. Please try --help."
58 exit 1
59 fi
51 if [ ${install_path_num} -gt 1 ]; then60 if [ ${install_path_num} -gt 1 ]; then
52 print "ERROR" "Do not input --install-path many times. Please try --help."61 print "ERROR" "Do not input --install-path many times. Please try --help."
53 exit 162 exit 1
@@ -55,7 +64,21 @@ function check_args() {
55}64}
56 65 
57function execute_run() {66function execute_run() {
58 bash install.sh ${install_path} ${package_arch} ${install_for_all_flag}67 if [ ${uninstall_flag} -eq 1 ]; then
68 bash uninstall.sh ${install_path}
69 if [ $? -ne 0 ]; then
70 print "ERROR" "${MSPROF_RUN_NAME} package uninstall failed."
71 exit 1
72 fi
73 print "INFO" "${MSPROF_RUN_NAME} package uninstall success."
74 elif [ ${install_args_num} -gt 0 ]; then
75 bash install.sh ${install_path} ${install_for_all_flag}
76 if [ $? -ne 0 ]; then
77 print "ERROR" "${MSPROF_RUN_NAME} package install failed."
78 exit 1
79 fi
80 print "INFO" "${MSPROF_RUN_NAME} package install success, the path is: '${install_path}'."
81 fi
59}82}
60 83 
61function get_default_install_path() {84function get_default_install_path() {
@@ -72,5 +95,4 @@ install_path=$(get_default_install_path)
72#0, this footnote path;1, path for executing run;2, parents' dir for run package;3, run params95#0, this footnote path;1, path for executing run;2, parents' dir for run package;3, run params
73parse_script_args $*96parse_script_args $*
74check_args97check_args
75execute_run98execute_run
76print "INFO" "${MSPROF_RUN_NAME} package install success, the path is: '${install_path}'."
Mscripts/run_script/uninstall.sh+35-142
@@ -1,146 +1,39 @@
1#!/bin/bash1#!/bin/bash
2 2# uninstall constant
3function unregist_uninstall() {3# -------------------------------------------------------------------------
4 if [ -f "${install_path}/cann_uninstall.sh" ]; then4# Copyright (c) 2026 Huawei Technologies Co., Ltd.
5 chmod u+w ${install_path}/cann_uninstall.sh5# This file is part of the MindStudio project.
6 remove_uninstall_package "${install_path}/cann_uninstall.sh"6#
7 if [ -f "${install_path}/cann_uninstall.sh" ]; then7# MindStudio is licensed under Mulan PSL v2.
8 chmod u-w ${install_path}/cann_uninstall.sh8# You can use this software according to the terms and conditions of the Mulan PSL v2.
9 fi9# You may obtain a copy of Mulan PSL v2 at:
10 fi10#
11}11# http://license.coscl.org.cn/MulanPSL2
12 12#
13function remove_uninstall_package() {13# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
14 local uninstall_file=$114# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
15 if [ -f "${uninstall_file}" ]; then15# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
16 sed -i "/uninstall_package \"${MSPROF_RUN_NAME}\/script\"/d" "${uninstall_file}"16# See the Mulan PSL v2 for more details.
17 if [ $? -ne 0 ]; then17# -------------------------------------------------------------------------
18 print "ERROR" "remove ${uninstall_file} uninstall_package command failed!"18CUR_DIR=$(dirname $(readlink -f $0))
19 exit 119CANN_INSTALL_PATH=${CUR_DIR}/../../../..
20 fi20if [ -z "${1}" ]; then
21 fi21 install_path=${CANN_INSTALL_PATH}
22 num=$(grep "^uninstall_package " ${uninstall_file} | wc -l)22else
23 if [ ${num} -eq 0 ]; then23 install_path=${1}
24 rm -f "${uninstall_file}" > /dev/null 2>&1
25 if [ $? -ne 0 ]; then
26 print "ERROR" "delete file: ${uninstall_file}failed, please delete it by yourself."
27 fi
28 fi
29}
30 
31function uninstall_product() {
32 delete_product ${install_path}/${ANALYSIS_PATH}/${ANALYSIS}
33 delete_mindstudio_msprof
34 delete_parent_dir
35}
36 
37function delete_product() {
38 local target_path=${1}
39 
40 if [ ! -f "$target_path" ] && [ ! -d "$target_path" ]; then
41 return
42 fi
43 
44 local parent_dir=$(dirname ${target_path})
45 local right=$(stat -c '%a' ${parent_dir})
46 
47 chmod u+w ${parent_dir}
48
49 chmod -R u+w ${target_path}
50 rm -rf ${target_path}
51 
52 chmod ${right} ${parent_dir}
53}
54 
55function delete_mindstudio_msprof() {
56 if [ ! -d "${install_path}/${MSPROF_RUN_NAME}" ]; then
57 return
58 fi
59 
60 chmod -R u+w ${install_path}/${MSPROF_RUN_NAME}
61 rm -rf ${install_path}/${MSPROF_RUN_NAME}
62}
63 
64function delete_parent_dir(){
65 # must from in to out
66 remove_dir_by_order ${install_path}/tools/profiler/profiler_tool
67 remove_dir_by_order ${install_path}/tools/profiler
68 remove_dir_by_order ${install_path}/tools
69 remove_dir_by_order ${install_path}
70}
71 
72function remove_dir_by_order() {
73 local dir_name=${1}
74 
75 if [ ! -d "${dir_name}" ]; then
76 return
77 fi
78 
79 local parent_dir=$(dirname ${dir_name})
80 local parent_dir_right=$(stat -c '%a' ${parent_dir})
81 
82 chmod u+w ${parent_dir}
83 remove_empty_dir ${dir_name}
84 chmod ${parent_dir_right} ${parent_dir}
85}
86 
87function uninstall_latest() {
88 local arch_name="${package_arch}-linux"
89 if [ -L "${latest_path}/${arch_name}/bin/${MSPROF}" ]; then
90 chmod u+w "${latest_path}/${arch_name}"
91 chmod u+w "${latest_path}/${arch_name}/bin"
92 rm_file_safe "${latest_path}/${arch_name}/bin/${MSPROF}"
93 remove_empty_dir "${latest_path}/${arch_name}/bin"
94 if [ -d "${latest_path}/${arch_name}/bin" ]; then
95 chmod u-w "${latest_path}/${arch_name}/bin"
96 fi
97 chmod u-w "${latest_path}/${arch_name}"
98 fi
99 
100 # runtime has been uninstall
101 local leader_package="runtime"
102 
103 if [ -L "${latest_path}/${MSPROF_RUN_NAME}" ]; then
104 rm_file_safe ${latest_path}/${MSPROF_RUN_NAME}
105 fi
106 
107 # single version or multi version old
108 if [ ! -L "${latest_path}/${leader_package}" ] || [ ! -d "${latest_path}/${leader_package}/../${MSPROF_RUN_NAME}" ]; then
109 return
110 fi
111 
112 # multi version new
113 local mindstudio_msprof_abs_path=$(dirname $(readlink -f ${latest_path}/${leader_package}/../${MSPROF_RUN_NAME}))
114 local version_name=$(basename ${mindstudio_msprof_abs_path})
115 ln -sf ../${version_name}/${MSPROF_RUN_NAME} ${latest_path}/${MSPROF_RUN_NAME}
116}
117 
118# must use readlink, or can not bash by latest
119uninstall_location=$(readlink -f ${0})
120 
121source $(dirname ${uninstall_location})/utils.sh
122 
123# get path
124install_path=$(dirname ${uninstall_location})/../../
125if [ ! -d "${install_path}" ]; then
126 print "ERROR" "Can not find install path."
127 exit 1
128fi24fi
129install_path="$(
130 cd ${install_path}
131 pwd
132)"
133 25 
134latest_path=$(dirname ${uninstall_location})/../../../latest26function delete_register_uninstall() {
135if [ ! -d "${latest_path}" ]; then27 if [ ! -f "${install_path}/${CANN_UNINSTALL_SCRIPT}" ]; then
136 print "ERROR" "Can not find latest path."28 print ${LEVEL_ERROR} "Failed to delete_register_uninstall, no such file: ${install_path}/${CANN_UNINSTALL_SCRIPT}"
137 exit 129 return 1
138fi30 fi
139latest_path="$(31 local script_right=$(stat -c '%a' "${install_path}/${CANN_UNINSTALL_SCRIPT}")
140 cd ${latest_path}32 chmod u+w "${install_path}/${CANN_UNINSTALL_SCRIPT}"
141 pwd33 sed -i "/uninstall_package \"share\/info\/msprof\/script\"/d" "${install_path}/${CANN_UNINSTALL_SCRIPT}"
142)"34 chmod ${script_right} "${install_path}/${CANN_UNINSTALL_SCRIPT}"
35}
143 36 
144unregist_uninstall37source utils.sh
145uninstall_product38remove ${install_path}/${ANALYSIS_PATH}
146uninstall_latest39delete_register_uninstall
Ascripts/run_script/uninstall_old.sh+146-0
@@ -0,0 +1,146 @@
1#!/bin/bash
2 
3function unregist_uninstall() {
4 if [ -f "${install_path}/cann_uninstall.sh" ]; then
5 chmod u+w ${install_path}/cann_uninstall.sh
6 remove_uninstall_package "${install_path}/cann_uninstall.sh"
7 if [ -f "${install_path}/cann_uninstall.sh" ]; then
8 chmod u-w ${install_path}/cann_uninstall.sh
9 fi
10 fi
11}
12 
13function remove_uninstall_package() {
14 local uninstall_file=$1
15 if [ -f "${uninstall_file}" ]; then
16 sed -i "/uninstall_package \"${MSPROF_RUN_NAME}\/script\"/d" "${uninstall_file}"
17 if [ $? -ne 0 ]; then
18 print "ERROR" "remove ${uninstall_file} uninstall_package command failed!"
19 exit 1
20 fi
21 fi
22 num=$(grep "^uninstall_package " ${uninstall_file} | wc -l)
23 if [ ${num} -eq 0 ]; then
24 rm -f "${uninstall_file}" > /dev/null 2>&1
25 if [ $? -ne 0 ]; then
26 print "ERROR" "delete file: ${uninstall_file}failed, please delete it by yourself."
27 fi
28 fi
29}
30 
31function uninstall_product() {
32 delete_product ${install_path}/${ANALYSIS_PATH}/${ANALYSIS}
33 delete_mindstudio_msprof
34 delete_parent_dir
35}
36 
37function delete_product() {
38 local target_path=${1}
39 
40 if [ ! -f "$target_path" ] && [ ! -d "$target_path" ]; then
41 return
42 fi
43 
44 local parent_dir=$(dirname ${target_path})
45 local right=$(stat -c '%a' ${parent_dir})
46 
47 chmod u+w ${parent_dir}
48
49 chmod -R u+w ${target_path}
50 rm -rf ${target_path}
51 
52 chmod ${right} ${parent_dir}
53}
54 
55function delete_mindstudio_msprof() {
56 if [ ! -d "${install_path}/${MSPROF_RUN_NAME}" ]; then
57 return
58 fi
59 
60 chmod -R u+w ${install_path}/${MSPROF_RUN_NAME}
61 rm -rf ${install_path}/${MSPROF_RUN_NAME}
62}
63 
64function delete_parent_dir(){
65 # must from in to out
66 remove_dir_by_order ${install_path}/tools/profiler/profiler_tool
67 remove_dir_by_order ${install_path}/tools/profiler
68 remove_dir_by_order ${install_path}/tools
69 remove_dir_by_order ${install_path}
70}
71 
72function remove_dir_by_order() {
73 local dir_name=${1}
74 
75 if [ ! -d "${dir_name}" ]; then
76 return
77 fi
78 
79 local parent_dir=$(dirname ${dir_name})
80 local parent_dir_right=$(stat -c '%a' ${parent_dir})
81 
82 chmod u+w ${parent_dir}
83 remove_empty_dir ${dir_name}
84 chmod ${parent_dir_right} ${parent_dir}
85}
86 
87function uninstall_latest() {
88 local arch_name="${package_arch}-linux"
89 if [ -L "${latest_path}/${arch_name}/bin/${MSPROF}" ]; then
90 chmod u+w "${latest_path}/${arch_name}"
91 chmod u+w "${latest_path}/${arch_name}/bin"
92 rm_file_safe "${latest_path}/${arch_name}/bin/${MSPROF}"
93 remove_empty_dir "${latest_path}/${arch_name}/bin"
94 if [ -d "${latest_path}/${arch_name}/bin" ]; then
95 chmod u-w "${latest_path}/${arch_name}/bin"
96 fi
97 chmod u-w "${latest_path}/${arch_name}"
98 fi
99 
100 # runtime has been uninstall
101 local leader_package="runtime"
102 
103 if [ -L "${latest_path}/${MSPROF_RUN_NAME}" ]; then
104 rm_file_safe ${latest_path}/${MSPROF_RUN_NAME}
105 fi
106 
107 # single version or multi version old
108 if [ ! -L "${latest_path}/${leader_package}" ] || [ ! -d "${latest_path}/${leader_package}/../${MSPROF_RUN_NAME}" ]; then
109 return
110 fi
111 
112 # multi version new
113 local mindstudio_msprof_abs_path=$(dirname $(readlink -f ${latest_path}/${leader_package}/../${MSPROF_RUN_NAME}))
114 local version_name=$(basename ${mindstudio_msprof_abs_path})
115 ln -sf ../${version_name}/${MSPROF_RUN_NAME} ${latest_path}/${MSPROF_RUN_NAME}
116}
117 
118# must use readlink, or can not bash by latest
119uninstall_location=$(readlink -f ${0})
120 
121source $(dirname ${uninstall_location})/utils.sh
122 
123# get path
124install_path=$(dirname ${uninstall_location})/../../
125if [ ! -d "${install_path}" ]; then
126 print "ERROR" "Can not find install path."
127 exit 1
128fi
129install_path="$(
130 cd ${install_path}
131 pwd
132)"
133 
134latest_path=$(dirname ${uninstall_location})/../../../latest
135if [ ! -d "${latest_path}" ]; then
136 print "ERROR" "Can not find latest path."
137 exit 1
138fi
139latest_path="$(
140 cd ${latest_path}
141 pwd
142)"
143 
144unregist_uninstall
145uninstall_product
146uninstall_latest
Mscripts/run_script/utils.sh+16-0
@@ -29,6 +29,9 @@ MSPROF="msprof"
29 29 
30ANALYSIS_PATH="tools/profiler/profiler_tool"30ANALYSIS_PATH="tools/profiler/profiler_tool"
31MSPROF_PATH="tools/profiler/bin"31MSPROF_PATH="tools/profiler/bin"
32SHARE_INFO_DIR="share/info"
33UNINSTALL_SCRIPT="uninstall.sh"
34CANN_UNINSTALL_SCRIPT="cann_uninstall.sh"
32 35 
33# msprof analysis whl36# msprof analysis whl
34MSPROF_ANALYSIS_WHL="msprof-0.0.1-py3-none-any.whl"37MSPROF_ANALYSIS_WHL="msprof-0.0.1-py3-none-any.whl"
@@ -41,6 +44,19 @@ function print() {
41 fi44 fi
42}45}
43 46 
47function remove() {
48 local target_path=${1}
49 if [ ! -d "${target_path}" ] && [ ! -f "${target_path}" ]; then
50 return
51 fi
52 local parent_dir=$(dirname ${target_path})
53 local parent_right=$(stat -c '%a' ${parent_dir})
54 chmod u+wx ${parent_dir}
55 chmod -R u+wx ${target_path}
56 rm -rf ${target_path}
57 chmod ${parent_right} ${parent_dir}
58}
59 
44function get_log_file() {60function get_log_file() {
45 local log_dir61 local log_dir
46 if [ "$UID" = "0" ]; then62 if [ "$UID" = "0" ]; then