OpenCode Deployer commited on
Commit ·
316b3ee
1
Parent(s): f51efaa
update
Browse files- script/clone-hf-spaces.sh +0 -32
- service/nodejs-service.sh +1 -1
script/clone-hf-spaces.sh
CHANGED
|
@@ -9,7 +9,6 @@
|
|
| 9 |
# GIT_PROJECT_1=mywpsite_2
|
| 10 |
|
| 11 |
cd /home
|
| 12 |
-
# git clone https://${GIT_USER_1}:${GIT_ACCESSTOKEN_1}@huggingface.co/spaces/${GIT_USER_1}/${GIT_PROJECT_1}
|
| 13 |
|
| 14 |
index=1
|
| 15 |
while true; do
|
|
@@ -28,34 +27,3 @@ while true; do
|
|
| 28 |
|
| 29 |
index=$((index + 1))
|
| 30 |
done
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
# git remote set-url origin https://airsltd:hf_xxxx@huggingface.co/spaces/airsltd/mywpsite
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
platform="HF"
|
| 39 |
-
var_type="USER"
|
| 40 |
-
|
| 41 |
-
for index in 1 2; do
|
| 42 |
-
# 1. 构造目标环境变量名
|
| 43 |
-
user_name="${platform}_${var_type}_${index}"
|
| 44 |
-
|
| 45 |
-
# 2. 尝试动态获取环境变量的值
|
| 46 |
-
target_value="${!user_name:-}" # 使用:-运算符,如果变量未设置或为空,则使用空字符串作为默认值
|
| 47 |
-
|
| 48 |
-
# 3. 判断获取是否成功
|
| 49 |
-
# 间接引用一个未定义的变量不会导致命令失败(退出码非0),但值为空。
|
| 50 |
-
# 更可靠的判断是检查该变量名是否在环境中被定义(包括空值)。
|
| 51 |
-
if declare -p "$user_name" &>/dev/null; then
|
| 52 |
-
# 变量存在(即使值为空字符串)
|
| 53 |
-
echo "环境变量 $user_name 的值是: $target_value"
|
| 54 |
-
else
|
| 55 |
-
# 变量根本不存在,视为获取失败
|
| 56 |
-
echo "错误: 环境变量 $user_name 未设置,获取失败。" >&2
|
| 57 |
-
# 根据需求,可以选择跳出循环或继续处理下一个
|
| 58 |
-
# 此处示例为跳出整个循环
|
| 59 |
-
break
|
| 60 |
-
fi
|
| 61 |
-
done
|
|
|
|
| 9 |
# GIT_PROJECT_1=mywpsite_2
|
| 10 |
|
| 11 |
cd /home
|
|
|
|
| 12 |
|
| 13 |
index=1
|
| 14 |
while true; do
|
|
|
|
| 27 |
|
| 28 |
index=$((index + 1))
|
| 29 |
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
service/nodejs-service.sh
CHANGED
|
@@ -4,7 +4,7 @@ echo "将要安装 nodejs 20"
|
|
| 4 |
echo ""
|
| 5 |
# 安装 Node.js 和必要依赖
|
| 6 |
apt-get update
|
| 7 |
-
apt-get install -y curl
|
| 8 |
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
| 9 |
apt-get install -y nodejs
|
| 10 |
apt-get clean
|
|
|
|
| 4 |
echo ""
|
| 5 |
# 安装 Node.js 和必要依赖
|
| 6 |
apt-get update
|
| 7 |
+
apt-get install -y curl vim
|
| 8 |
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
| 9 |
apt-get install -y nodejs
|
| 10 |
apt-get clean
|