#!/bin/bash if [ $EUID != 0 ]; then echo "评测机脚本需要使用 root 权限,请先使用 sudo su 切换到 root 用户后再运行此脚本。" exit $? fi # 切换到 root 目录(cd 不需要 sudo,因为脚本可能已用 root 执行) cd /root || { echo "无法进入 /root 目录"; exit 1; } # 下载缓存文件(如果需要验证文件,可添加 -c 断点续传或 --check-certificate=off 忽略证书) echo "正在下载 gcc9.3.0 缓存文件..." wget http://10.16.80.222:3000/Weishen/Hydro-Setup/raw/branch/main/gcc9.3.0-cache.nix -O gcc9.3.0-cache.nix || { echo "下载失败,请检查网络或文件地址"; exit 1; } # 导入缓存到 nix-store(需要 root 权限) echo "正在导入缓存文件..." nix-store --import < gcc9.3.0-cache.nix || { echo "导入缓存失败"; exit 1; } rm gcc9.3.0-cache.nix echo "gcc9.3.0 缓存导入成功!"