已合并
【PR】: fix docs:日志拼写错误修改 #1459
【PR】: fix docs:日志拼写错误修改 #1459
已合并
qwh138创建于 7月24日
1 个文件变更+89-89
@@ -8,7 +8,7 @@
8# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.8# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
9# See LICENSE in the root of the software repository for the full text of the License.9# See LICENSE in the root of the software repository for the full text of the License.
10# ----------------------------------------------------------------------------------------------------------------------10# ----------------------------------------------------------------------------------------------------------------------
11- 11+ 
12default_root_dir="/usr/local/Ascend"12default_root_dir="/usr/local/Ascend"
13default_normal_dir="${HOME}/Ascend"13default_normal_dir="${HOME}/Ascend"
14username=$(id -un)14username=$(id -un)
@@ -22,26 +22,26 @@ graph_autofusion_func_path="${curpath}/graph_autofusion_func.sh"
22pkg_version_path="${curpath}/../version.info"22pkg_version_path="${curpath}/../version.info"
23install_info_old="/etc/ascend_install.info"23install_info_old="/etc/ascend_install.info"
24run_dir="$(echo "$2" | cut -d'-' -f 3-)"24run_dir="$(echo "$2" | cut -d'-' -f 3-)"
25- 25+ 
26. "${common_func_path}"26. "${common_func_path}"
27. "${version_compat_func_path}"27. "${version_compat_func_path}"
28. "${common_func_v2_path}"28. "${common_func_v2_path}"
29. "${version_cfg_path}"29. "${version_cfg_path}"
30. "${graph_autofusion_func_path}"30. "${graph_autofusion_func_path}"
31- 31+ 
32if [ "$(id -u)" != "0" ]; then32if [ "$(id -u)" != "0" ]; then
33 log_dir="${HOME}/var/log/ascend_seclog"33 log_dir="${HOME}/var/log/ascend_seclog"
34else34else
35 log_dir="/var/log/ascend_seclog"35 log_dir="/var/log/ascend_seclog"
36fi36fi
37- 37+ 
38if [ ! -d "$log_dir" ]; then38if [ ! -d "$log_dir" ]; then
39 mkdir -p "$log_dir"39 mkdir -p "$log_dir"
40fi40fi
41- 41+ 
42operation_logfile="${log_dir}/operation.log"42operation_logfile="${log_dir}/operation.log"
43logfile="${log_dir}/ascend_install.log"43logfile="${log_dir}/ascend_install.log"
44- 44+ 
45# 递归授权45# 递归授权
46chmod_recur() {46chmod_recur() {
47 local file_path="${1}"47 local file_path="${1}"
@@ -54,7 +54,7 @@ chmod_recur() {
54 find "$file_path" -type f -exec chmod "$permission" {} \; 2> /dev/null54 find "$file_path" -type f -exec chmod "$permission" {} \; 2> /dev/null
55 fi55 fi
56}56}
57- 57+ 
58# 单目录授权58# 单目录授权
59chmod_single_dir() {59chmod_single_dir() {
60 local file_path="${1}"60 local file_path="${1}"
@@ -67,7 +67,7 @@ chmod_single_dir() {
67 chmod "$permission" "$file_path"67 chmod "$permission" "$file_path"
68 fi68 fi
69}69}
70- 70+ 
71# 设置权限71# 设置权限
72set_file_chmod() {72set_file_chmod() {
73 local permission="${1}"73 local permission="${1}"
@@ -79,7 +79,7 @@ set_file_chmod() {
79 echo "$permission"79 echo "$permission"
80 fi80 fi
81}81}
82- 82+ 
83# 运行前授权83# 运行前授权
84chmod_start() {84chmod_start() {
85 local tmpdir="$1"85 local tmpdir="$1"
@@ -87,18 +87,18 @@ chmod_start() {
87 chmod_recur "$tmpdir" 750 dir 2> /dev/null87 chmod_recur "$tmpdir" 750 dir 2> /dev/null
88 chmod_recur "$tmpdir/python" 750 dir 2> /dev/null88 chmod_recur "$tmpdir/python" 750 dir 2> /dev/null
89}89}
90- 90+ 
91# 运行结束授权91# 运行结束授权
92chmod_end() {92chmod_end() {
93 local current_install_path="$pkg_install_path"93 local current_install_path="$pkg_install_path"
94 if [ "$pkg_is_multi_version" = "true" ]; then94 if [ "$pkg_is_multi_version" = "true" ]; then
95 current_install_path="$current_install_path/$pkg_version_dir"95 current_install_path="$current_install_path/$pkg_version_dir"
96 fi96 fi
97- 97+ 
98 # data dir/file permission98 # data dir/file permission
99 chmod_recur "$default_dir/python" 750 dir99 chmod_recur "$default_dir/python" 750 dir
100 chmod_recur "$current_install_path/python" 750 dir100 chmod_recur "$current_install_path/python" 750 dir
101- 101+ 
102 if [ "$pylocal" = "y" ]; then102 if [ "$pylocal" = "y" ]; then
103 chmod_recur "$current_install_path/python/site-packages/superkernel" 550 dir103 chmod_recur "$current_install_path/python/site-packages/superkernel" 550 dir
104 chmod_recur "$current_install_path/python/site-packages/superkernel" 550 file104 chmod_recur "$current_install_path/python/site-packages/superkernel" 550 file
@@ -106,7 +106,7 @@ chmod_end() {
106 chmod_recur "$current_install_path/python/site-packages/superkernel-0.1.0.dist-info" 550 file106 chmod_recur "$current_install_path/python/site-packages/superkernel-0.1.0.dist-info" 550 file
107 chmod_recur "$current_install_path/python/site-packages/LICENSE" 440 file107 chmod_recur "$current_install_path/python/site-packages/LICENSE" 440 file
108 fi108 fi
109- 109+ 
110 chmod_single_dir "$default_dir/ascend_install.info" 640 file 2> /dev/null110 chmod_single_dir "$default_dir/ascend_install.info" 640 file 2> /dev/null
111 chmod_single_dir "$default_dir/version.info" 440 file 2> /dev/null111 chmod_single_dir "$default_dir/version.info" 440 file 2> /dev/null
112 chmod_single_dir "$default_dir/scene.info" 640 file 2> /dev/null112 chmod_single_dir "$default_dir/scene.info" 640 file 2> /dev/null
@@ -120,7 +120,7 @@ chmod_end() {
120 chown -R "root:root" "$default_dir/script" 2> /dev/null120 chown -R "root:root" "$default_dir/script" 2> /dev/null
121 fi121 fi
122}122}
123- 123+ 
124ver_check() {124ver_check() {
125 local version_info_file=""125 local version_info_file=""
126 if [ -f "${install_info_old}" ] && [ $(grep -c -i driver_install_path_param "$install_info_old") -ne 0 ]; then126 if [ -f "${install_info_old}" ] && [ $(grep -c -i driver_install_path_param "$install_info_old") -ne 0 ]; then
@@ -160,11 +160,11 @@ ver_check() {
160 log "WARNING" "Cannot find the install path of driver."160 log "WARNING" "Cannot find the install path of driver."
161 fi161 fi
162}162}
163- 163+ 
164param_usage() {164param_usage() {
165 log "INFO" "Please input this command for help: ./${runfilename} --help"165 log "INFO" "Please input this command for help: ./${runfilename} --help"
166}166}
167- 167+ 
168# 修改日志文件的权限168# 修改日志文件的权限
169change_log_mode() {169change_log_mode() {
170 if [ ! -f "$logfile" ]; then170 if [ ! -f "$logfile" ]; then
@@ -172,7 +172,7 @@ change_log_mode() {
172 fi172 fi
173 chmod 640 "$logfile"173 chmod 640 "$logfile"
174}174}
175- 175+ 
176# 创建日志文件夹176# 创建日志文件夹
177create_log_folder() {177create_log_folder() {
178 if [ ! -d "$log_dir" ]; then178 if [ ! -d "$log_dir" ]; then
@@ -184,7 +184,7 @@ create_log_folder() {
184 chmod 750 "$log_dir"184 chmod 750 "$log_dir"
185 fi185 fi
186}186}
187- 187+ 
188# 写日志188# 写日志
189log() {189log() {
190 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"190 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"
@@ -204,7 +204,7 @@ log() {
204 echo "$log_format" >> "$logfile"204 echo "$log_format" >> "$logfile"
205 fi205 fi
206}206}
207- 207+ 
208# 静默模式日志打印208# 静默模式日志打印
209new_echo() {209new_echo() {
210 local log_type="$1"210 local log_type="$1"
@@ -213,7 +213,7 @@ new_echo() {
213 echo "${log_type}" "${log_msg}" 1> /dev/null213 echo "${log_type}" "${log_msg}" 1> /dev/null
214 fi214 fi
215}215}
216- 216+ 
217# 开始安装前打印开始信息217# 开始安装前打印开始信息
218start_install_log() {218start_install_log() {
219 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"219 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"
@@ -223,7 +223,7 @@ start_install_log() {
223 log "INFO" "InputParams:$all_parma"223 log "INFO" "InputParams:$all_parma"
224 log "INFO" "OperationLogFile:${operation_logfile}"224 log "INFO" "OperationLogFile:${operation_logfile}"
225}225}
226- 226+ 
227# 开始卸载前打印开始信息227# 开始卸载前打印开始信息
228start_uninstall_log() {228start_uninstall_log() {
229 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"229 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"
@@ -233,7 +233,7 @@ start_uninstall_log() {
233 log "INFO" "InputParams:$all_parma"233 log "INFO" "InputParams:$all_parma"
234 log "INFO" "OperationLogFile:${operation_logfile}"234 log "INFO" "OperationLogFile:${operation_logfile}"
235}235}
236- 236+ 
237# 安装结束退出前打印结束信息237# 安装结束退出前打印结束信息
238exit_install_log() {238exit_install_log() {
239 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"239 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"
@@ -241,7 +241,7 @@ exit_install_log() {
241 log "INFO" "End time:${cur_date}"241 log "INFO" "End time:${cur_date}"
242 exit "$1"242 exit "$1"
243}243}
244- 244+ 
245# 安装结束退出前打印结束信息245# 安装结束退出前打印结束信息
246exit_uninstall_log() {246exit_uninstall_log() {
247 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"247 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"
@@ -249,7 +249,7 @@ exit_uninstall_log() {
249 log "INFO" "End time:${cur_date}"249 log "INFO" "End time:${cur_date}"
250 exit "$1"250 exit "$1"
251}251}
252- 252+ 
253# 安全日志253# 安全日志
254log_operation() {254log_operation() {
255 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"255 local cur_date="$(date +'%Y-%m-%d %H:%M:%S')"
@@ -263,15 +263,15 @@ log_operation() {
263 else263 else
264 level="UNKNOWN"264 level="UNKNOWN"
265 fi265 fi
266- 266+ 
267 if [ ! -f "${operation_logfile}" ]; then267 if [ ! -f "${operation_logfile}" ]; then
268 touch "${operation_logfile}"268 touch "${operation_logfile}"
269 chmod 640 "${operation_logfile}"269 chmod 640 "${operation_logfile}"
270 fi270 fi
271- 271+ 
272 echo "$1 $level root $cur_date 127.0.0.1 $runfilename $2 installmode=$installmode; cmdlist=$all_parma" >> "$operation_logfile"272 echo "$1 $level root $cur_date 127.0.0.1 $runfilename $2 installmode=$installmode; cmdlist=$all_parma" >> "$operation_logfile"
273}273}
274- 274+ 
275# 相对路径转化绝对路径275# 相对路径转化绝对路径
276relative_path_to_absolute_path() {276relative_path_to_absolute_path() {
277 local relative_path_="${1}"277 local relative_path_="${1}"
@@ -286,7 +286,7 @@ relative_path_to_absolute_path() {
286 fi286 fi
287 echo "$relative_path_"287 echo "$relative_path_"
288}288}
289- 289+ 
290# 获取安装路径290# 获取安装路径
291get_install_path() {291get_install_path() {
292 local ppath=""292 local ppath=""
@@ -308,12 +308,12 @@ get_install_path() {
308 fi308 fi
309 fi309 fi
310}310}
311- 311+ 
312create_install_dir() {312create_install_dir() {
313 local path="$1"313 local path="$1"
314 local user_and_group="$2"314 local user_and_group="$2"
315 local permission=""315 local permission=""
316- 316+ 
317 if [ $(id -u) -eq 0 ]; then317 if [ $(id -u) -eq 0 ]; then
318 user_and_group="root:root"318 user_and_group="root:root"
319 permission=755319 permission=755
@@ -324,7 +324,7 @@ create_install_dir() {
324 permission=750324 permission=750
325 fi325 fi
326 fi326 fi
327- 327+ 
328 if [ "x${path}" = "x" ]; then328 if [ "x${path}" = "x" ]; then
329 log "WARNING" "dir path is empty"329 log "WARNING" "dir path is empty"
330 return 1330 return 1
@@ -345,7 +345,7 @@ create_install_dir() {
345 return 1345 return 1
346 fi346 fi
347}347}
348- 348+ 
349create_file() {349create_file() {
350 local _file="$1"350 local _file="$1"
351 if [ -d "${_file}" ]; then351 if [ -d "${_file}" ]; then
@@ -359,7 +359,7 @@ create_file() {
359 fi359 fi
360 return 0360 return 0
361}361}
362- 362+ 
363# 判断输入的指定路径是否存在363# 判断输入的指定路径是否存在
364is_valid_path() {364is_valid_path() {
365 if [ "x${pkg_install_path}" != "x" ]; then365 if [ "x${pkg_install_path}" != "x" ]; then
@@ -379,7 +379,7 @@ is_valid_path() {
379 exit 1379 exit 1
380 fi380 fi
381 if [ "${ret}" -ne 0 ]; then381 if [ "${ret}" -ne 0 ]; then
382- log "WARNING" "You are going to put run-files on a unsecure install-path, do you want to continue? [y/n]"382+ log "WARNING" "You are going to put run-files on an insecure install-path, do you want to continue? [y/n]"
383 while true383 while true
384 do384 do
385 read yn385 read yn
@@ -405,7 +405,7 @@ is_valid_path() {
405 fi405 fi
406 fi406 fi
407}407}
408- 408+ 
409# 递归判断安装路的属组和权限409# 递归判断安装路的属组和权限
410parent_dirs_permission_check() {410parent_dirs_permission_check() {
411 local current_dir="$1"411 local current_dir="$1"
@@ -413,11 +413,11 @@ parent_dirs_permission_check() {
413 local short_install_dir=""413 local short_install_dir=""
414 local owner=""414 local owner=""
415 local mod_num=""415 local mod_num=""
416- 416+ 
417 parent_dir=$(dirname "${current_dir}")417 parent_dir=$(dirname "${current_dir}")
418 short_install_dir=$(basename "${current_dir}")418 short_install_dir=$(basename "${current_dir}")
419 log "INFO" "parent_dir value is [${parent_dir}] and children_dir value is [${short_install_dir}]"419 log "INFO" "parent_dir value is [${parent_dir}] and children_dir value is [${short_install_dir}]"
420- 420+ 
421 if [ "x${current_dir}" = "x/" ]; then421 if [ "x${current_dir}" = "x/" ]; then
422 log "INFO" "parent_dirs_permission_check succeeded"422 log "INFO" "parent_dirs_permission_check succeeded"
423 return 0423 return 0
@@ -428,7 +428,7 @@ parent_dirs_permission_check() {
428 return 1428 return 1
429 fi429 fi
430 log "INFO" "[${short_install_dir}] belongs to root."430 log "INFO" "[${short_install_dir}] belongs to root."
431- 431+ 
432 mod_num=$(stat -c %a "${parent_dir}/${short_install_dir}")432 mod_num=$(stat -c %a "${parent_dir}/${short_install_dir}")
433 mod_num=$(check_chmod_length "$mod_num")433 mod_num=$(check_chmod_length "$mod_num")
434 if [ "${mod_num}" -lt 755 ]; then434 if [ "${mod_num}" -lt 755 ]; then
@@ -443,7 +443,7 @@ parent_dirs_permission_check() {
443 parent_dirs_permission_check "${parent_dir}"443 parent_dirs_permission_check "${parent_dir}"
444 fi444 fi
445}445}
446- 446+ 
447check_chmod_length() {447check_chmod_length() {
448 local mod_num="$1"448 local mod_num="$1"
449 local new_mod_num=""449 local new_mod_num=""
@@ -456,7 +456,7 @@ check_chmod_length() {
456 echo "$new_mod_num"456 echo "$new_mod_num"
457 fi457 fi
458}458}
459- 459+ 
460# 校验用户和组的关联关系460# 校验用户和组的关联关系
461check_group() {461check_group() {
462 local group_user_related=""462 local group_user_related=""
@@ -472,7 +472,7 @@ check_group() {
472 return 1472 return 1
473 fi473 fi
474}474}
475- 475+ 
476# 解锁476# 解锁
477unchattr_files() {477unchattr_files() {
478 if [ -f "$install_info" ]; then478 if [ -f "$install_info" ]; then
@@ -487,7 +487,7 @@ unchattr_files() {
487 fi487 fi
488 fi488 fi
489}489}
490- 490+ 
491# 创建普通用户的默认安装目录491# 创建普通用户的默认安装目录
492create_default_install_dir_for_common_user() {492create_default_install_dir_for_common_user() {
493 if [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ]; then493 if [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ]; then
@@ -496,7 +496,7 @@ create_default_install_dir_for_common_user() {
496 fi496 fi
497 fi497 fi
498}498}
499- 499+ 
500# 创建子包安装目录500# 创建子包安装目录
501create_default_dir() {501create_default_dir() {
502 if [ ! -d "$default_dir" ]; then502 if [ ! -d "$default_dir" ]; then
@@ -508,7 +508,7 @@ create_default_dir() {
508 [ -d "$default_dir" ] && return 0508 [ -d "$default_dir" ] && return 0
509 return 1509 return 1
510}510}
511- 511+ 
512# 获取安装目录下的完整版本号512# 获取安装目录下的完整版本号
513get_version_installed() {513get_version_installed() {
514 local installed_version="none"514 local installed_version="none"
@@ -517,7 +517,7 @@ get_version_installed() {
517 fi517 fi
518 echo "$installed_version"518 echo "$installed_version"
519}519}
520- 520+ 
521# 获取本包中的完整版本号521# 获取本包中的完整版本号
522get_version_in_runpkg() {522get_version_in_runpkg() {
523 local version_in_runpkg="none"523 local version_in_runpkg="none"
@@ -526,7 +526,7 @@ get_version_in_runpkg() {
526 fi526 fi
527 echo "$version_in_runpkg"527 echo "$version_in_runpkg"
528}528}
529- 529+ 
530# 更新基础版本号530# 更新基础版本号
531update_version_info_version() {531update_version_info_version() {
532 if [ -f "$default_dir/version.info" ]; then532 if [ -f "$default_dir/version.info" ]; then
@@ -539,7 +539,7 @@ update_version_info_version() {
539 fi539 fi
540 chmod_single_dir "$default_dir/version.info" 440 file >> /dev/null 2>&1540 chmod_single_dir "$default_dir/version.info" 440 file >> /dev/null 2>&1
541}541}
542- 542+ 
543log_base_version() {543log_base_version() {
544 if [ -f "$install_info" ]; then544 if [ -f "$install_info" ]; then
545 local installed_version="$(get_version_installed)"545 local installed_version="$(get_version_installed)"
@@ -554,14 +554,14 @@ log_base_version() {
554 log "WARNING" "base version was destroyed or not exist."554 log "WARNING" "base version was destroyed or not exist."
555 fi555 fi
556}556}
557- 557+ 
558update_install_path() {558update_install_path() {
559 if [ ! -d "$pkg_install_path" ]; then559 if [ ! -d "$pkg_install_path" ]; then
560 log "ERROR" "ERR_NO:0x0003;ERR_DES:The $pkg_install_path dose not exist, please retry a right path."560 log "ERROR" "ERR_NO:0x0003;ERR_DES:The $pkg_install_path dose not exist, please retry a right path."
561 exit_install_log 1561 exit_install_log 1
562 fi562 fi
563}563}
564- 564+ 
565update_install_param() {565update_install_param() {
566 local _key="$1"566 local _key="$1"
567 local _val="$2"567 local _val="$2"
@@ -583,12 +583,12 @@ update_install_param() {
583 fi583 fi
584 done584 done
585}585}
586- 586+ 
587get_install_param() {587get_install_param() {
588 local _key="$1"588 local _key="$1"
589 local _file="$2"589 local _file="$2"
590 local _param=""590 local _param=""
591- 591+ 
592 if [ ! -f "${_file}" ]; then592 if [ ! -f "${_file}" ]; then
593 exit 1593 exit 1
594 fi594 fi
@@ -601,7 +601,7 @@ get_install_param() {
601 done601 done
602 echo "${_param}"602 echo "${_param}"
603}603}
604- 604+ 
605update_install_info() {605update_install_info() {
606 chmod_start606 chmod_start
607 if [ ! -f "$install_info" ]; then607 if [ ! -f "$install_info" ]; then
@@ -612,7 +612,7 @@ update_install_info() {
612 update_install_param "GRAPH_AUTOFUSION_UserGroup" "$usergroup" "$install_info"612 update_install_param "GRAPH_AUTOFUSION_UserGroup" "$usergroup" "$install_info"
613 update_install_param "GRAPH_AUTOFUSION_Install_Path_Param" "$install_path_param" "$install_info"613 update_install_param "GRAPH_AUTOFUSION_Install_Path_Param" "$install_path_param" "$install_info"
614}614}
615- 615+ 
616prompt_set_env() {616prompt_set_env() {
617 local install_path="$1"617 local install_path="$1"
618 if [ -n "$pkg_version_dir" ]; then618 if [ -n "$pkg_version_dir" ]; then
@@ -622,7 +622,7 @@ prompt_set_env() {
622 - PATH includes ${install_path}/bin622 - PATH includes ${install_path}/bin
623 - LD_LIBRARY_PATH includes ${install_path}/lib64"623 - LD_LIBRARY_PATH includes ${install_path}/lib64"
624}624}
625- 625+ 
626check_docker_path() {626check_docker_path() {
627 local docker_path="$1"627 local docker_path="$1"
628 if [ $(expr substr "${docker_path}" 1 1) != "/" ]; then628 if [ $(expr substr "${docker_path}" 1 1) != "/" ]; then
@@ -635,7 +635,7 @@ check_docker_path() {
635 exit 1635 exit 1
636 fi636 fi
637}637}
638- 638+ 
639concat_docker_install_path() {639concat_docker_install_path() {
640 local docker_path="$1"640 local docker_path="$1"
641 local install_path=""641 local install_path=""
@@ -646,7 +646,7 @@ concat_docker_install_path() {
646 install_path="${docker_path}$2"646 install_path="${docker_path}$2"
647 echo "${install_path}"647 echo "${install_path}"
648}648}
649- 649+ 
650#######################################################650#######################################################
651# 安装调用子脚本651# 安装调用子脚本
652install_run() {652install_run() {
@@ -683,7 +683,7 @@ install_run() {
683 fi683 fi
684 return $?684 return $?
685}685}
686- 686+ 
687# 升级调用子脚本687# 升级调用子脚本
688upgrade_run() {688upgrade_run() {
689 local operation="Upgrade"689 local operation="Upgrade"
@@ -724,7 +724,7 @@ upgrade_run() {
724 fi724 fi
725 return $?725 return $?
726}726}
727- 727+ 
728# 卸载调用子脚本728# 卸载调用子脚本
729uninstall_run() {729uninstall_run() {
730 local is_recreate_softlink="$2"730 local is_recreate_softlink="$2"
@@ -782,7 +782,7 @@ uninstall_run() {
782 fi782 fi
783 return $?783 return $?
784}784}
785- 785+ 
786save_user_files_to_log() {786save_user_files_to_log() {
787 if [ "$1" = "${default_dir}" ] && [ -s "$1" ]; then787 if [ "$1" = "${default_dir}" ] && [ -s "$1" ]; then
788 local filenum=$(ls -lR "$1"|grep "^-"|wc -l)788 local filenum=$(ls -lR "$1"|grep "^-"|wc -l)
@@ -813,7 +813,7 @@ save_user_files_to_log() {
813 done813 done
814 fi814 fi
815}815}
816- 816+ 
817judgmentpath() {817judgmentpath() {
818 . "${common_func_path}"818 . "${common_func_path}"
819 check_install_path_valid "${1}"819 check_install_path_valid "${1}"
@@ -822,14 +822,14 @@ judgmentpath() {
822 exit 1822 exit 1
823 fi823 fi
824}824}
825- 825+ 
826unique_mode() {826unique_mode() {
827 if [ ! -z "$g_param_check_flag" ]; then827 if [ ! -z "$g_param_check_flag" ]; then
828 log "ERROR" "ERR_NO:0x0004;ERR_DES:only support one type: full/run/docker/devel/upgrade/uninstall, operation failed!"828 log "ERROR" "ERR_NO:0x0004;ERR_DES:only support one type: full/run/docker/devel/upgrade/uninstall, operation failed!"
829 exit 1829 exit 1
830 fi830 fi
831}831}
832- 832+ 
833check_install_for_all() {833check_install_for_all() {
834 local mod_num=""834 local mod_num=""
835 local other_mod_num=""835 local other_mod_num=""
@@ -843,7 +843,7 @@ check_install_for_all() {
843 fi843 fi
844 fi844 fi
845}845}
846- 846+ 
847migrate_user_assets_v2() {847migrate_user_assets_v2() {
848 if [ "$pkg_is_multi_version" = "true" ]; then848 if [ "$pkg_is_multi_version" = "true" ]; then
849 get_package_last_installed_version_dir "last_installed_dir" "$pkg_install_path" "graph_autofusion"849 get_package_last_installed_version_dir "last_installed_dir" "$pkg_install_path" "graph_autofusion"
@@ -859,10 +859,10 @@ migrate_user_assets_v2() {
859 fi859 fi
860 fi860 fi
861}861}
862- 862+ 
863####################################################################################################863####################################################################################################
864runfilename=$(expr substr "$1" 5 $(expr ${#1} - 4))864runfilename=$(expr substr "$1" 5 $(expr ${#1} - 4))
865- 865+ 
866full_install=n866full_install=n
867run_install=n867run_install=n
868docker_install=n868docker_install=n
@@ -886,7 +886,7 @@ is_quiet=n
886check=n886check=n
887install_path_param=""887install_path_param=""
888g_param_check_flag=""888g_param_check_flag=""
889- 889+ 
890if [ $(id -u) -eq 0 ]; then890if [ $(id -u) -eq 0 ]; then
891 input_install_for_all=y891 input_install_for_all=y
892 input_install_path="$default_root_dir"892 input_install_path="$default_root_dir"
@@ -896,16 +896,16 @@ else
896 input_install_path="$default_normal_dir"896 input_install_path="$default_normal_dir"
897 install_path_param="$default_normal_dir"897 install_path_param="$default_normal_dir"
898fi898fi
899- 899+ 
900create_log_folder900create_log_folder
901change_log_mode901change_log_mode
902- 902+ 
903####################################################################################################903####################################################################################################
904if [ "$#" = "1" ] || [ "$#" = "2" ]; then904if [ "$#" = "1" ] || [ "$#" = "2" ]; then
905 log "ERROR" "ERR_NO:0x0004;ERR_DES:Unrecognized parameters. Try './xxx.run --help for more information.'"905 log "ERROR" "ERR_NO:0x0004;ERR_DES:Unrecognized parameters. Try './xxx.run --help for more information.'"
906 exit 1906 exit 1
907fi907fi
908- 908+ 
909i=0909i=0
910while true910while true
911do911do
@@ -920,9 +920,9 @@ do
920 fi920 fi
921 shift 1921 shift 1
922done922done
923- 923+ 
924all_parma="$*"924all_parma="$*"
925- 925+ 
926#################################################################################926#################################################################################
927while true927while true
928do928do
@@ -1034,7 +1034,7 @@ do
1034 ;;1034 ;;
1035 esac1035 esac
1036done1036done
1037- 1037+ 
1038###################### 检查参数冲突 ###################1038###################### 检查参数冲突 ###################
1039if [ "${is_quiet}" = "y" ]; then1039if [ "${is_quiet}" = "y" ]; then
1040 if [ "${upgrade}" = "y" ] || [ "${full_install}" = "y" ] || [ "${run_install}" = "y" ] || [ "${devel_install}" = "y" ] || [ "${uninstall}" = "y" ]; then1040 if [ "${upgrade}" = "y" ] || [ "${full_install}" = "y" ] || [ "${run_install}" = "y" ] || [ "${devel_install}" = "y" ] || [ "${uninstall}" = "y" ]; then
@@ -1046,14 +1046,14 @@ if [ "${is_quiet}" = "y" ]; then
1046 exit 11046 exit 1
1047 fi1047 fi
1048fi1048fi
1049- 1049+ 
1050if [ "${pylocal}" = "y" ]; then1050if [ "${pylocal}" = "y" ]; then
1051 if [ "${upgrade}" != "y" ] && [ "${full_install}" != "y" ] && [ "${run_install}" != "y" ] && [ "${devel_install}" != "y" ]; then1051 if [ "${upgrade}" != "y" ] && [ "${full_install}" != "y" ] && [ "${run_install}" != "y" ] && [ "${devel_install}" != "y" ]; then
1052 log "ERROR" "'--pylocal' is not supported to used by this way, please use with '--full', '--devel', '--run' or '--upgrade'."1052 log "ERROR" "'--pylocal' is not supported to used by this way, please use with '--full', '--devel', '--run' or '--upgrade'."
1053 exit 11053 exit 1
1054 fi1054 fi
1055fi1055fi
1056- 1056+ 
1057# 卸载参数只支持单独使用1057# 卸载参数只支持单独使用
1058if [ "$uninstall" = "y" ]; then1058if [ "$uninstall" = "y" ]; then
1059 if [ "$upgrade" = "y" ] || [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ] || [ "$docker_install" = "y" ] || [ "$check" = "y" ]; then1059 if [ "$upgrade" = "y" ] || [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ] || [ "$docker_install" = "y" ] || [ "$check" = "y" ]; then
@@ -1061,50 +1061,50 @@ if [ "$uninstall" = "y" ]; then
1061 exit 11061 exit 1
1062 fi1062 fi
1063fi1063fi
1064- 1064+ 
1065if [ "$docker_install" = "y" ]; then1065if [ "$docker_install" = "y" ]; then
1066 log "ERROR" "ERR_NO:0x0004;ERR_DES:Unsupported parameters, operation failed."1066 log "ERROR" "ERR_NO:0x0004;ERR_DES:Unsupported parameters, operation failed."
1067- log "INFO" "--docker not uesd in graph_autofusion"1067+ log "INFO" "--docker not used in graph_autofusion"
1068 exit 11068 exit 1
1069fi1069fi
1070- 1070+ 
1071# 检查必选参数1071# 检查必选参数
1072if [ "${upgrade}" = "n" ] && [ "${full_install}" = "n" ] && [ "${run_install}" = "n" ] && [ "${devel_install}" = "n" ] && [ "${uninstall}" = "n" ] && [ "${check}" = "n" ]; then1072if [ "${upgrade}" = "n" ] && [ "${full_install}" = "n" ] && [ "${run_install}" = "n" ] && [ "${devel_install}" = "n" ] && [ "${uninstall}" = "n" ] && [ "${check}" = "n" ]; then
1073 log "ERROR" "ERR_NO:0x0004;One of parameters '--full', '--devel', '--run', '--upgrade', '--uninstall', '--check' must be used."1073 log "ERROR" "ERR_NO:0x0004;One of parameters '--full', '--devel', '--run', '--upgrade', '--uninstall', '--check' must be used."
1074 exit 11074 exit 1
1075fi1075fi
1076- 1076+ 
1077#######################################################1077#######################################################
1078is_multi_version_pkg "pkg_is_multi_version" "$pkg_version_path"1078is_multi_version_pkg "pkg_is_multi_version" "$pkg_version_path"
1079get_version_dir "pkg_version_dir" "$pkg_version_path"1079get_version_dir "pkg_version_dir" "$pkg_version_path"
1080- 1080+ 
1081if [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ] || [ "$upgrade" = "y" ] || [ "$uninstall" = "y" ] || [ "$check" = "y" ]; then1081if [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ] || [ "$upgrade" = "y" ] || [ "$uninstall" = "y" ] || [ "$check" = "y" ]; then
1082 input_install_path=$(relative_path_to_absolute_path "${input_install_path}")1082 input_install_path=$(relative_path_to_absolute_path "${input_install_path}")
1083 get_install_path1083 get_install_path
1084- 1084+ 
1085 install_top_path="$(dirname $input_install_path)"1085 install_top_path="$(dirname $input_install_path)"
1086 install_path_param="${input_install_path}"1086 install_path_param="${input_install_path}"
1087fi1087fi
1088- 1088+ 
1089if [ "$is_docker_install" = "y" ]; then1089if [ "$is_docker_install" = "y" ]; then
1090 pkg_install_path=$(concat_docker_install_path "${docker_root}" "${install_path_param}")1090 pkg_install_path=$(concat_docker_install_path "${docker_root}" "${install_path_param}")
1091else1091else
1092 pkg_install_path="${install_path_param}"1092 pkg_install_path="${install_path_param}"
1093fi1093fi
1094- 1094+ 
1095if [ "$pkg_is_multi_version" = "true" ]; then1095if [ "$pkg_is_multi_version" = "true" ]; then
1096 default_dir="${pkg_install_path}/$pkg_version_dir/share/info/graph_autofusion"1096 default_dir="${pkg_install_path}/$pkg_version_dir/share/info/graph_autofusion"
1097else1097else
1098 default_dir="${pkg_install_path}/share/info/graph_autofusion"1098 default_dir="${pkg_install_path}/share/info/graph_autofusion"
1099fi1099fi
1100install_info="${default_dir}/ascend_install.info"1100install_info="${default_dir}/ascend_install.info"
1101- 1101+ 
1102if [ "$uninstall" = "y" ]; then1102if [ "$uninstall" = "y" ]; then
1103 start_uninstall_log1103 start_uninstall_log
1104else1104else
1105 start_install_log1105 start_install_log
1106fi1106fi
1107- 1107+ 
1108# 版本兼容性检查1108# 版本兼容性检查
1109if [ "$check" = "y" ]; then1109if [ "$check" = "y" ]; then
1110 ver_check1110 ver_check
@@ -1123,7 +1123,7 @@ elif [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install"
1123 log "INFO" "version compatibility check successfully!"1123 log "INFO" "version compatibility check successfully!"
1124 fi1124 fi
1125fi1125fi
1126- 1126+ 
1127##################################################################1127##################################################################
1128# 安装升级运行态时, 1/2包必须已安装, 且指定的用户必须存在且与1/2包同属组1128# 安装升级运行态时, 1/2包必须已安装, 且指定的用户必须存在且与1/2包同属组
1129if [ "$input_install_for_all" = "n" ]; then1129if [ "$input_install_for_all" = "n" ]; then
@@ -1142,7 +1142,7 @@ if [ "$input_install_for_all" = "n" ]; then
1142 usergroup_base=$(grep -i usergroup= "${install_info_old}" | cut -d"=" -f2-)1142 usergroup_base=$(grep -i usergroup= "${install_info_old}" | cut -d"=" -f2-)
1143 check_group "${usergroup_base}" "${username}"1143 check_group "${usergroup_base}" "${username}"
1144 if [ $? -ne 0 ]; then1144 if [ $? -ne 0 ]; then
1145- log "ERROR" "ERR_NO:0x0093;ERR_DES:User is not belong to the dirver or firmware's installed usergroup! Please add the user (${username}) to the group (${usergroup_base})."1145+ log "ERROR" "ERR_NO:0x0093;ERR_DES:User is not belong to the driver or firmware's installed usergroup! Please add the user (${username}) to the group (${usergroup_base})."
1146 confirm=y1146 confirm=y
1147 exit_install_log 11147 exit_install_log 1
1148 fi1148 fi
@@ -1156,11 +1156,11 @@ log_base_version
1156if [ "$upgrade" != "y" ]; then1156if [ "$upgrade" != "y" ]; then
1157 is_valid_path1157 is_valid_path
1158fi1158fi
1159- 1159+ 
1160if [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ]; then1160if [ "$full_install" = "y" ] || [ "$run_install" = "y" ] || [ "$devel_install" = "y" ]; then
1161 create_default_dir1161 create_default_dir
1162fi1162fi
1163- 1163+ 
1164# 环境上是否已安装过本包1164# 环境上是否已安装过本包
1165version_installed="$(get_version_installed)"1165version_installed="$(get_version_installed)"
1166if [ "x$version_installed" != "x" -a "$version_installed" != "none" ] || [ -f "${install_info}" ]; then1166if [ "x$version_installed" != "x" -a "$version_installed" != "none" ] || [ -f "${install_info}" ]; then
@@ -1244,4 +1244,4 @@ else
1244 install_run "install"1244 install_run "install"
1245 exit_install_log 01245 exit_install_log 0
1246 fi1246 fi
1247-fi1247+fi