16
csrc/scripts/package/latest_manager/scripts/filelist.csv
Normal file
16
csrc/scripts/package/latest_manager/scripts/filelist.csv
Normal file
@@ -0,0 +1,16 @@
|
||||
module,operation,relative_path_in_pkg,relative_install_path,is_in_docker,permission,owner:group,install_type,softlink,feature,is_common_path,configurable,hash,block,pkg_inner_softlink,chip
|
||||
NA,mkdir,NA,manager,TRUE,550,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/filelist.csv,manager/filelist.csv,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/install.sh,manager/install.sh,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/manager.sh,manager.sh,TRUE,550,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/manager_func.sh,manager/manager_func.sh,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/script_operator.inc,manager/script_operator.inc,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/uninstall.sh,manager/uninstall.sh,TRUE,550,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/version.info,manager/version.info,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/version_compatiable.inc,manager/version_compatiable.inc,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/check_version_required.awk,manager/check_version_required.awk,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/common_func_v2.inc,manager/common_func_v2.inc,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/common_func.inc,manager/common_func.inc,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/common_installer.inc,manager/common_installer.inc,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/install_common_parser.sh,manager/install_common_parser.sh,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
NA,copy,latest_manager/version_cfg.inc,manager/version_cfg.inc,TRUE,440,\\$username:\\$usergroup,all,NA,all,N,FALSE,NA,latest_manager,NA,all
|
||||
|
59
csrc/scripts/package/latest_manager/scripts/install.sh
Normal file
59
csrc/scripts/package/latest_manager/scripts/install.sh
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
# CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
# Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See LICENSE in the root of the software repository for the full text of the License.
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
CURPATH=$(dirname $(readlink -f "$0"))
|
||||
USERNAME=$(id -un)
|
||||
USERGROUP=$(id -gn)
|
||||
common_func_path="${CURPATH}/common_func.inc"
|
||||
|
||||
. "$common_func_path"
|
||||
|
||||
INSTALL_PATH=""
|
||||
IS_UPGRADE="n"
|
||||
|
||||
set_comm_log "Latest_manager" "$COMM_LOGFILE"
|
||||
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
--install-path=*)
|
||||
INSTALL_PATH="$(echo "$1" | cut -d"=" -f2-)"
|
||||
shift
|
||||
;;
|
||||
--upgrade)
|
||||
IS_UPGRADE="y"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
comm_log "ERROR" "Unsupported parameters : $1"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$INSTALL_PATH" = "" ]; then
|
||||
comm_log "ERROR" "--install-path parameter is required!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! sh "$CURPATH/install_common_parser.sh" --package="latest_manager" --install --username="$USERNAME" --usergroup="$USERGROUP" \
|
||||
--simple-install "full" "$INSTALL_PATH" "$CURPATH/filelist.csv" "all"; then
|
||||
comm_log "ERROR" "install failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$IS_UPGRADE" = "y" ] && ! "$INSTALL_PATH/manager.sh" "migrate_latest_data"; then
|
||||
comm_log "ERROR" "migrate latest data failed!"
|
||||
exit 1
|
||||
fi
|
||||
128
csrc/scripts/package/latest_manager/scripts/manager.sh
Normal file
128
csrc/scripts/package/latest_manager/scripts/manager.sh
Normal file
@@ -0,0 +1,128 @@
|
||||
#!/bin/sh
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
# CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
# Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See LICENSE in the root of the software repository for the full text of the License.
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
CURPATH=$(dirname "$(readlink -f "$0")")
|
||||
VAR_PATH="$CURPATH"
|
||||
common_func_path="$CURPATH/manager/common_func.inc"
|
||||
version_compatiable_path="$CURPATH/manager/version_compatiable.inc"
|
||||
common_func_v2_path="$CURPATH/manager/common_func_v2.inc"
|
||||
version_cfg_path="$CURPATH/manager/version_cfg.inc"
|
||||
script_operator_path="$CURPATH/manager/script_operator.inc"
|
||||
manager_func_path="$CURPATH/manager/manager_func.sh"
|
||||
|
||||
. "$common_func_path"
|
||||
. "$version_compatiable_path"
|
||||
. "$common_func_v2_path"
|
||||
. "$version_cfg_path"
|
||||
. "$script_operator_path"
|
||||
. "$manager_func_path"
|
||||
|
||||
set_comm_log "Latest_manager" "$COMM_LOGFILE"
|
||||
|
||||
VERSION=""
|
||||
VERSION_DIR=""
|
||||
PACKAGE=""
|
||||
DOCKER_ROOT=""
|
||||
INTPUT_INSTALL_FOR_ALL="n"
|
||||
IS_RECREATE_SOFTLINK="n"
|
||||
INCREMENT="n"
|
||||
USE_SHARE_INFO="n"
|
||||
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
--version)
|
||||
VERSION="$2"
|
||||
shift 2
|
||||
;;
|
||||
--version-dir)
|
||||
VERSION_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--package)
|
||||
PACKAGE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--package-dir)
|
||||
shift 2
|
||||
;;
|
||||
--serial)
|
||||
shift 2
|
||||
;;
|
||||
--install-type)
|
||||
shift 2
|
||||
;;
|
||||
--feature)
|
||||
shift 2
|
||||
;;
|
||||
--chip)
|
||||
shift 2
|
||||
;;
|
||||
--filelist)
|
||||
shift 2
|
||||
;;
|
||||
--docker-root)
|
||||
DOCKER_ROOT="$2"
|
||||
shift 2
|
||||
;;
|
||||
--recreate-softlink)
|
||||
IS_RECREATE_SOFTLINK="y"
|
||||
shift 1
|
||||
;;
|
||||
--install-for-all)
|
||||
INTPUT_INSTALL_FOR_ALL="y"
|
||||
shift 1
|
||||
;;
|
||||
--increment)
|
||||
INCREMENT="y"
|
||||
shift 1
|
||||
;;
|
||||
--use-share-info)
|
||||
USE_SHARE_INFO="y"
|
||||
shift 1
|
||||
;;
|
||||
-*)
|
||||
comm_log "ERROR" "Unsupported parameters : $1"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$PACKAGE" != "" ]; then
|
||||
get_titled_package_name "TITLED_PACKAGE" "$PACKAGE"
|
||||
set_comm_log "$TITLED_PACKAGE" "$COMM_LOGFILE"
|
||||
fi
|
||||
|
||||
OPERATION="$1"
|
||||
|
||||
if [ "$OPERATION" = "package_installed" ]; then
|
||||
package_installed "$CURPATH" "$VERSION" "$VERSION_DIR" "$PACKAGE" \
|
||||
"$INTPUT_INSTALL_FOR_ALL" "$DOCKER_ROOT"
|
||||
elif [ "$OPERATION" = "package_pre_uninstall" ]; then
|
||||
package_pre_uninstall "$CURPATH" "$VERSION" "$VERSION_DIR" "$PACKAGE" \
|
||||
"$INTPUT_INSTALL_FOR_ALL" "$DOCKER_ROOT"
|
||||
elif [ "$OPERATION" = "package_uninstalled" ]; then
|
||||
package_uninstalled "$CURPATH" "$VERSION" "$VERSION_DIR" "$PACKAGE" "$IS_RECREATE_SOFTLINK" \
|
||||
"$DOCKER_ROOT"
|
||||
elif [ "$OPERATION" = "package_create_softlink" ]; then
|
||||
package_create_softlink "$CURPATH" "$VERSION" "$VERSION_DIR" "$PACKAGE" "$DOCKER_ROOT"
|
||||
elif [ "$OPERATION" = "package_remove_softlink" ]; then
|
||||
package_remove_softlink "$CURPATH" "$VERSION" "$VERSION_DIR" "$PACKAGE" "$DOCKER_ROOT"
|
||||
elif [ "$OPERATION" = "create_version_softlink" ]; then
|
||||
create_version_softlink "$CURPATH" "$VERSION_DIR"
|
||||
elif [ "$OPERATION" = "remove_latest_softlink" ]; then
|
||||
remove_latest_softlink "$CURPATH"
|
||||
elif [ "$OPERATION" = "migrate_latest_data" ]; then
|
||||
migrate_latest_data "$CURPATH"
|
||||
fi
|
||||
1736
csrc/scripts/package/latest_manager/scripts/manager_func.sh
Normal file
1736
csrc/scripts/package/latest_manager/scripts/manager_func.sh
Normal file
File diff suppressed because it is too large
Load Diff
52
csrc/scripts/package/latest_manager/scripts/uninstall.sh
Normal file
52
csrc/scripts/package/latest_manager/scripts/uninstall.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
||||
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
|
||||
# CANN Open Software License Agreement Version 2.0 (the "License").
|
||||
# Please refer to the License for details. You may not use this file except in compliance with the License.
|
||||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
|
||||
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See LICENSE in the root of the software repository for the full text of the License.
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
CURPATH=$(dirname $(readlink -f "$0"))
|
||||
VARPATH="$(dirname "$CURPATH")"
|
||||
USERNAME=$(id -un)
|
||||
USERGROUP=$(id -gn)
|
||||
common_func_path="$CURPATH/common_func.inc"
|
||||
manager_func_path="$CURPATH/manager_func.sh"
|
||||
|
||||
. "$common_func_path"
|
||||
. "$manager_func_path"
|
||||
|
||||
set_comm_log "Latest_manager" "$COMM_LOGFILE"
|
||||
|
||||
IS_UPGRADE="n"
|
||||
|
||||
while true
|
||||
do
|
||||
case "$1" in
|
||||
--upgrade)
|
||||
IS_UPGRADE="y"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! sh "$CURPATH/install_common_parser.sh" --package="latest_manager" --uninstall --username="$USERNAME" --usergroup="$USERGROUP" \
|
||||
--simple-uninstall "full" "$VARPATH" "$CURPATH/filelist.csv" "all"; then
|
||||
comm_log "ERROR" "uninstall failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$IS_UPGRADE" = "n" ]; then
|
||||
remove_manager_refs "$VARPATH"
|
||||
fi
|
||||
|
||||
if ! remove_dir_if_empty "$VARPATH"; then
|
||||
comm_log "ERROR" "uninstall failed!"
|
||||
exit 1
|
||||
fi
|
||||
1
csrc/scripts/package/latest_manager/scripts/version.info
Normal file
1
csrc/scripts/package/latest_manager/scripts/version.info
Normal file
@@ -0,0 +1 @@
|
||||
Version=45
|
||||
Reference in New Issue
Block a user