Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Fix scripts' calling parameters #5365

Merged
merged 3 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- **decompress:** Exclude '*.nsis' that may cause error ([#5294](https://github.com/ScoopInstaller/Scoop/issues/5294))
- **autoupdate:** Fix file hash extraction ([#5295](https://github.com/ScoopInstaller/Scoop/issues/5295))
- **shortcuts:** Output correctly formatted path ([#5333](https://github.com/ScoopInstaller/Scoop/issues/5333))
- **core:** Fix scripts' calling parameters ([#5365](https://github.com/ScoopInstaller/Scoop/issues/5365))
- **core:** Fix `is_in_dir` under Unix ([#5391](https://github.com/ScoopInstaller/Scoop/issues/5391))
- **env:** Avoid automatic expansion of `%%` in env ([#5395](https://github.com/ScoopInstaller/Scoop/issues/5395))
- **install:** Fix download from private GitHub repositories ([#5361](https://github.com/ScoopInstaller/Scoop/issues/5361))
Expand Down
9 changes: 7 additions & 2 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1067,13 +1067,18 @@ function ensure_none_failed($apps) {
foreach ($app in $apps) {
$app = ($app -split '/|\\')[-1] -replace '\.json$', ''
foreach ($global in $true, $false) {
if ($global) {
$instArgs = @('--global')
} else {
$instArgs = @()
}
if (failed $app $global) {
if (installed $app $global) {
info "Repair previous failed installation of $app."
& "$PSScriptRoot\..\libexec\scoop-reset.ps1" $app$(if ($global) { ' --global' })
& "$PSScriptRoot\..\libexec\scoop-reset.ps1" $app @instArgs
} else {
warn "Purging previous failed installation of $app."
& "$PSScriptRoot\..\libexec\scoop-uninstall.ps1" $app$(if ($global) { ' --global' })
& "$PSScriptRoot\..\libexec\scoop-uninstall.ps1" $app @instArgs
}
}
}
Expand Down
23 changes: 11 additions & 12 deletions libexec/scoop-import.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,19 @@ foreach ($item in $import.buckets) {
}

foreach ($item in $import.apps) {
$instArgs = @()
$holdArgs = @()
$info = $item.Info -Split ', '
$global = if ('Global install' -in $info) {
' --global'
} else {
''
if ('Global install' -in $info) {
$instArgs += '--global'
$holdArgs += '--global'
}
$arch = if ('64bit' -in $info -and '64bit' -ne $def_arch) {
' --arch 64bit'
if ('64bit' -in $info -and '64bit' -ne $def_arch) {
$instArgs += '--arch', '64bit'
} elseif ('32bit' -in $info -and '32bit' -ne $def_arch) {
' --arch 32bit'
$instArgs += '--arch', '32bit'
} elseif ('arm64' -in $info -and 'arm64' -ne $def_arch) {
' --arch arm64'
} else {
''
$instArgs += '--arch', 'arm64'
}

$app = if ($item.Source -in $bucket_names) {
Expand All @@ -58,9 +57,9 @@ foreach ($item in $import.apps) {
$item.Source
}

& "$PSScriptRoot\scoop-install.ps1" $app$global$arch
& "$PSScriptRoot\scoop-install.ps1" $app @instArgs

if ('Held package' -in $info) {
& "$PSScriptRoot\scoop-hold.ps1" $($item.Name)$global
& "$PSScriptRoot\scoop-hold.ps1" $item.Name @holdArgs
}
}