mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:40:49 +00:00
fix: clarify install switching
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
# Or: & ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard
|
||||
|
||||
param(
|
||||
[ValidateSet("npm", "git")]
|
||||
[string]$InstallMethod = "npm",
|
||||
[string]$Tag = "latest",
|
||||
[string]$GitDir = "$env:USERPROFILE\openclaw",
|
||||
@@ -336,11 +337,13 @@ function Install-OpenClawGit {
|
||||
if (!(Test-Path $wrapperDir)) {
|
||||
New-Item -ItemType Directory -Path $wrapperDir -Force | Out-Null
|
||||
}
|
||||
|
||||
|
||||
$entryPath = Join-Path $RepoDir "dist\entry.js"
|
||||
@"
|
||||
@echo off
|
||||
node "%~dp0..\openclaw\dist\entry.js" %*
|
||||
node "$entryPath" %*
|
||||
"@ | Out-File -FilePath "$wrapperDir\openclaw.cmd" -Encoding ASCII -Force
|
||||
Add-ToPath -Path $wrapperDir
|
||||
|
||||
Write-Host "OpenClaw installed" -Level success
|
||||
return $true
|
||||
@@ -432,7 +435,12 @@ function Main {
|
||||
if ($DryRun) {
|
||||
Write-Host "[DRY RUN] Would install OpenClaw from git to $GitDir" -Level info
|
||||
} else {
|
||||
Install-OpenClawGit -RepoDir $GitDir -Update:(-not $NoGitUpdate)
|
||||
try {
|
||||
npm uninstall -g openclaw 2>$null | Out-Null
|
||||
} catch { }
|
||||
if (!(Install-OpenClawGit -RepoDir $GitDir -Update:(-not $NoGitUpdate))) {
|
||||
return (Fail-Install)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# npm method
|
||||
@@ -443,6 +451,11 @@ function Main {
|
||||
if ($DryRun) {
|
||||
Write-Host "[DRY RUN] Would install OpenClaw via npm ($((Resolve-PackageInstallSpec -Target $Tag)))" -Level info
|
||||
} else {
|
||||
$gitWrapper = "$env:USERPROFILE\.local\bin\openclaw.cmd"
|
||||
if (Test-Path $gitWrapper) {
|
||||
Remove-Item -Force $gitWrapper
|
||||
Write-Host "Removed git wrapper (switching to npm)" -Level info
|
||||
}
|
||||
if (!(Install-OpenClawNpm -Target $Tag)) {
|
||||
return (Fail-Install)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user