1 Star 0 Fork 1

zwq/tensorrt

forked from src-oepkgs/tensorrt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
common.sh 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
zwq 提交于 2022-12-12 11:59 . 第一轮提交
#!/bin/bash
# 校验入口脚本参数
function check_build_param() {
if [[ $# -ne 0 && "$1" ]]; then
echo "Execute the following command to install:"
echo "bash /path/to/build.sh"
exit 1
fi
}
# 打印当前运行脚本信息
function print_current_running_script_info() {
exec_path=$(get_current_dir)
echo "# ------------------------------------------------------------------------"
echo "# ${exec_path}/$1 正在运行"
}
#检查入参个数和路径格式
function is_check_build_install_directory() {
if [[ $# -ne 3 ]]; then
echo "The format is as follows:"
echo "bash $3 buildpath installpath"
echo ":param buildpath: 应用构建绝对路径"
echo ":param installpath: 应用安装绝对路径"
exit 1
fi
[[ ! "$1" =~ ^/.* || "$1" = "/" ]] && echo "请输入正确的构建路径" && exit 1
[[ ! "$2" =~ ^/.* || "$2" = "/" ]] && echo "请输入正确的安装路径" && exit 1
echo "# ------------------------------------------------------------------------"
echo "# $3 正在运行"
}
# 校验构建路径与安装路径是否为同一路径
function is_equal_build_install_path() {
local buildpath
local installpath
buildpath="$1"
installpath="$2"
[[ "${buildpath}" =~ .*/$ ]] && buildpath=${buildpath%/*}
[[ "${installpath}" =~ .*/$ ]] && installpath=${installpath%/*}
[[ "${buildpath}" == "${installpath}" ]] && echo "构建路径与安装路径需为不同路径" && exit 1
echo "# 构建路径为$1"
echo "# 安装路径为$2"
}
# 创建文件夹
function create_dir() {
# local path
# path="$1"
# [[ "$path" =~ .*/$ ]] && path=${path%/*}
# if [[ ! -d "${path}" && ! -f "${path}" ]]; then
# mkdir -p "${path}"
# elif [[ -n "$(ls -A "$1")" ]]; then
# path=$path$(date "+%y%m%d%H%M%S") && mkdir -p "${path}"
# fi
# echo "${path}"
local path
base_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
path=${base_path}/"$1"
[[ "$path" =~ .*/$ ]] && path=${path%/*}
if [[ ! -f "${path}" ]]; then
rm -rf "${path}"
mkdir -p "${path}"
fi
echo "${path}"
}
# 获取当前文件夹路径
function get_current_dir() {
local current_dir
current_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
echo "${current_dir}"
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jamdodot/tensorrt.git
git@gitee.com:jamdodot/tensorrt.git
jamdodot
tensorrt
tensorrt
master

搜索帮助