copilot login
This commit is contained in:
@@ -299,7 +299,7 @@ if ($nodeVer -match "v\d+") {
|
|||||||
Write-Info "安装 WSL2 Node.js LTS (via nvm)..."
|
Write-Info "安装 WSL2 Node.js LTS (via nvm)..."
|
||||||
$installNodeCmd = @'
|
$installNodeCmd = @'
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
sudo apt-get install -y -qq curl ca-certificates 2>/dev/null
|
sudo apt-get install -y -qq curl ca-certificates wslu 2>/dev/null
|
||||||
# 安装 nvm
|
# 安装 nvm
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
if [ ! -d "$NVM_DIR" ]; then
|
if [ ! -d "$NVM_DIR" ]; then
|
||||||
@@ -388,7 +388,7 @@ if ($ghVer -notmatch "MISSING") {
|
|||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
sudo mkdir -p -m 755 /etc/apt/keyrings
|
sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||||
if [ ! -f /etc/apt/keyrings/githubcli-archive-keyring.gpg ]; then
|
if [ ! -f /etc/apt/keyrings/githubcli-archive-keyring.gpg ]; then
|
||||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
curl -fsSL --connect-timeout 20 --max-time 30 https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||||
| sudo dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg status=none
|
| sudo dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg status=none
|
||||||
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||||
fi
|
fi
|
||||||
@@ -396,14 +396,22 @@ if [ ! -f /etc/apt/sources.list.d/github-cli.list ]; then
|
|||||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
||||||
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||||
fi
|
fi
|
||||||
sudo apt-get update -qq
|
if sudo apt-get update -qq -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 2>/dev/null && \
|
||||||
sudo apt-get install -y -qq gh
|
sudo apt-get install -y -qq -o Acquire::http::Timeout=30 gh 2>/dev/null; then
|
||||||
gh --version | head -1
|
echo GH_INSTALL_OK
|
||||||
|
else
|
||||||
|
echo GH_INSTALL_FAIL
|
||||||
|
fi
|
||||||
true
|
true
|
||||||
'@
|
'@
|
||||||
Invoke-WSL $installGhCmd
|
$ghInstallResult = Invoke-WSL $installGhCmd -IgnoreError
|
||||||
$ghVer = Invoke-WSL "gh --version 2>/dev/null | head -1 || echo MISSING" -IgnoreError
|
$ghVer = Invoke-WSL "gh --version 2>/dev/null | head -1 || echo MISSING" -IgnoreError
|
||||||
Write-OK "GitHub CLI 安装完成: $($ghVer.Trim())"
|
if ($ghInstallResult -match "GH_INSTALL_FAIL" -or $ghVer -match "MISSING") {
|
||||||
|
Write-Warn "GitHub CLI 安装失败(网络超时),跳过;后续可手动安装:wsl -d Ubuntu -- sudo apt install gh"
|
||||||
|
$ghVer = "MISSING"
|
||||||
|
} else {
|
||||||
|
Write-OK "GitHub CLI 安装完成: $($ghVer.Trim())"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ghCopilotInstalled.Trim() -eq "0") {
|
if ($ghCopilotInstalled.Trim() -eq "0") {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export DEBIAN_FRONTEND=noninteractive
|
|||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -y -qq \
|
sudo apt-get install -y -qq \
|
||||||
curl wget git build-essential pkg-config libssl-dev \
|
curl wget git build-essential pkg-config libssl-dev \
|
||||||
ca-certificates gnupg lsb-release unzip python3
|
ca-certificates gnupg lsb-release unzip python3 wslu
|
||||||
log "系统依赖安装完成"
|
log "系统依赖安装完成"
|
||||||
|
|
||||||
# ──────────────────────────────────────────────────────────────
|
# ──────────────────────────────────────────────────────────────
|
||||||
@@ -144,7 +144,7 @@ else
|
|||||||
log "安装 GitHub CLI..."
|
log "安装 GitHub CLI..."
|
||||||
sudo mkdir -p -m 755 /etc/apt/keyrings
|
sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||||
if [ ! -f /etc/apt/keyrings/githubcli-archive-keyring.gpg ]; then
|
if [ ! -f /etc/apt/keyrings/githubcli-archive-keyring.gpg ]; then
|
||||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
curl -fsSL --connect-timeout 20 --max-time 30 https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||||
| sudo dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg status=none
|
| sudo dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg status=none
|
||||||
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||||
fi
|
fi
|
||||||
@@ -152,9 +152,12 @@ else
|
|||||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
||||||
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||||
fi
|
fi
|
||||||
sudo apt-get update -qq
|
if sudo apt-get update -qq -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 2>/dev/null && \
|
||||||
sudo apt-get install -y -qq gh
|
sudo apt-get install -y -qq -o Acquire::http::Timeout=30 gh 2>/dev/null; then
|
||||||
log "GitHub CLI 安装完成: $(gh --version 2>/dev/null | head -1)"
|
log "GitHub CLI 安装完成: $(gh --version 2>/dev/null | head -1)"
|
||||||
|
else
|
||||||
|
warn "GitHub CLI 安装失败(网络超时),跳过;后续可手动安装:sudo apt install gh"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if gh extension list 2>/dev/null | grep -q 'github/gh-copilot'; then
|
if gh extension list 2>/dev/null | grep -q 'github/gh-copilot'; then
|
||||||
|
|||||||
Reference in New Issue
Block a user