fix: keep bun, opencode coommand in env

This commit is contained in:
2025-12-25 17:27:28 +08:00
parent 35034f5e2d
commit b250a3693b
4 changed files with 16 additions and 3 deletions

View File

@@ -5,7 +5,9 @@ set -e
mkdir -p /root/.ssh
chmod 700 /root/.ssh
touch /root/.ssh/authorized_keys
touch /root/.ssh/environment
printenv | grep -E '^(PATH|BUN|CARGO|RUST|ANTHROPIC|OPENAI|OPENCODE|TERM|SHELL|WORKSPACE)' > /root/.ssh/environment
# 2. 动态注入挂载的公钥 (解决只读冲突的核心逻辑)
if [ -f /tmp/host_id_ed25519.pub ]; then
echo "检测到挂载的公钥,正在注入..."
@@ -20,7 +22,7 @@ fi
# 3. 强制修复权限 (SSH 对此非常敏感)
chmod 600 /root/.ssh/authorized_keys
chown root:root /root/.ssh/authorized_keys
chown -R root:root /root/.ssh
# 根据不同 OS 启动 SSH