Datasets:
Download install.sh from leequeue/MIPR: direct link, hf CLI and curl.
- Browser
- Download file 3.37 kB
-
https://huggingface.co/datasets/leequeue/MIPR/resolve/main/install.sh
- Command line
-
hf download hf://datasets/leequeue/MIPR/install.sh
-
curl -L -o install.sh https://huggingface.co/datasets/leequeue/MIPR/resolve/main/install.sh
3.37 kB
| # 打印函数,用于统一日志格式 | |
| log() { | |
| echo "$(date '+%Y-%m-%d %H:%M:%S') [INFO] $1" | |
| } | |
| # 检查操作系统架构的函数 | |
| get_os_arch() { | |
| case $(uname -m) in | |
| arm64) | |
| echo "arm" | |
| ;; | |
| x86_64) | |
| echo "x86" | |
| ;; | |
| *) | |
| echo "unknown" | |
| ;; | |
| esac | |
| } | |
| # 获取用户的邮箱和用户名 | |
| get_user_info() { | |
| local manual_input=false | |
| git tig install | |
| if [ ! -t 0 ]; then | |
| echo "请运行git tig login -u <用户名> -p <代码平台令牌>" | |
| echo "代码平台令牌可访问 https://code.alibaba-inc.com/profile/account 获取" | |
| exit 0 | |
| fi | |
| while true; do | |
| if ! $manual_input; then | |
| username=$(git config user.name) | |
| if [[ -z "$username" ]]; then | |
| read -rp "请输入您的域账号(例如,bogw.wbg): " username | |
| manual_input=true | |
| fi | |
| else | |
| read -rp "请输入您的域账号(例如,bogw.wbg): " username | |
| fi | |
| # 引导用户获取私钥令牌 | |
| read -rp "请访问 https://code.alibaba-inc.com/profile/account 并输入您的私钥令牌: " token | |
| echo "" | |
| log "登录并安装全局钩子..." | |
| echo "git tig login -u $username -p $token" | |
| if ! git tig login -u $username -p $token; then | |
| log "登录失败,请检查您的凭证是否正确。" | |
| manual_input=true | |
| continue | |
| else | |
| break | |
| fi | |
| done | |
| if [ $? -ne 0 ]; then | |
| log "安装全局钩子失败。" | |
| exit 1 | |
| fi | |
| } | |
| # Step 1: 根据操作系统类型和架构安装 | |
| os_type=$(uname) | |
| version=latest | |
| target="/usr/local/bin/git-tig" | |
| sudo='sudo' | |
| case "$os_type" in | |
| Linux*) | |
| log "检测到Linux系统,正在安装git-tig..." | |
| platform="linux" | |
| download_file="https://git-tig.oss-cn-hangzhou-zmf.aliyuncs.com/release/$platform/$version/git-tig" | |
| ;; | |
| Darwin*) | |
| log "检测到macOS系统,正在安装git-tig..." | |
| platform="osx-universal" | |
| download_file="https://git-tig.oss-cn-hangzhou-zmf.aliyuncs.com/release/$platform/$version/git-tig" | |
| ;; | |
| CYGWIN* | MINGW* | MSYS_NT* ) | |
| log "检测到windows系统,正在安装git-tig..." | |
| platform="win64" | |
| target="/usr/bin/git-tig.exe" | |
| download_file="https://git-tig.oss-cn-hangzhou-zmf.aliyuncs.com/release/$platform/$version/git-tig.exe" | |
| sudo='' | |
| ;; | |
| *) | |
| log "不支持的操作系统。如果您使用的是windows系统,请以管理员身份运行Git Bash并在Git Bash中执行安装命令。" | |
| exit 1 | |
| esac | |
| log '下载git-tig到/tmp-tig' | |
| log "curl \"$download_file\" -o /tmp/git-tig" | |
| curl "$download_file" -o /tmp/git-tig | |
| log '下载完成' | |
| log 'mv /tmp/git-tig $target' | |
| $sudo mv /tmp/git-tig $target | |
| log "tig 被安装到 $target" | |
| log '设置可执行权限' | |
| $sudo chmod +x $target | |
| if [ $? -ne 0 ]; then | |
| log "设置可执行权限失败。" | |
| exit 1 | |
| fi | |
| log "安装成功。" | |
| # Step 3: 验证安装 | |
| log "验证安装..." | |
| if git tig -V &> /dev/null; then | |
| log "安装验证成功!" | |
| else | |
| log "安装验证失败。" | |
| exit 1 | |
| fi | |
| # Step 4: 获取用户信息和配置 | |
| get_user_info | |
| log "设置完成!" |