mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 06:07:56 +00:00
* fix (decompress): `Expand-7zipArchive` only delete temp dir / `$extractDir` if it is empty (#6092) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * refactor(download): Move download-related functions to 'download.ps1' (#6095) * fix(download): Fallback to default downloader when aria2 fails (#4292) * fix(commands): Handling broken aliases (#6141) * fix(shim): properly check `wslpath`/`cygpath` command first (#6114) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * fix(scoop-bucket): Add missing import for `no_junction` envs (#6181) Signed-off-by: Chawye Hsu <su+git@chawyehsu.com> * docs(chglog): Update to 0.5.3 (#6258) * perf(shim): Update kiennq-shim to v3.1.2 (#6261) * fix(decompress): Replace deprecated 7ZIPEXTRACT_USE_EXTERNAL config (#6327) Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * fix(scoop-uninstall): Fix uninstaller does not gain Global state (#6430) * global arg * changelog * refactor(Get-Manifest): Select actual source for manifest (#6142) * first step * Revert "first step" This reverts commitc5907c3e25. * refactor(Get-Manifest): Select actual source for installed manifest * rework sub-commands, `scoop-depends` is NOT working at this stage * URI manifest * opt * deprecated manifest * source of manifests * source of manifest pt2 - Mark URI(path/URL/UNC/etc.) query as standalone manifest - Drop `installed` and `available update` items for [query] and [installed] are different sources. * remove variable preventing I forget it * scoop-info: fix source of manifest on bucket * fix `scoop-depends` * Fix Standalone and Source detection * fix global install * Fix scoop-cat, scoop-home - Query for remote manifest * scoop-list: info +deprecated * manifest: Fix first selected manifest * gramma.. * Fix61b3259* length * fix(scoop-depends-tests): Mocking `USE_EXTERNAL_7ZIP` as $false (#6431) * fix(scoop-depends-tests): Mocking `USE_EXTERNAL_7ZIP` as $false to avoding error when it is $true * CHANGELOG * feat(autoupdate): GitHub predefined hashes support (#6416) * feat(autoupdate): predefined hash case for GitHub - Remove `sha256:` prefix in `format_hash()` - Add GitHub support in `get_hash_for_app()` Close #6381 * doc(chglog): GitHub auto hash update * fix(autoupdate): remove prefix only * docs(CHANGELOG): Update to 0.5.3 (#6432) * docs(CHANGELOG): Update to 0.5.3 * 6416 --------- Signed-off-by: Chawye Hsu <su+git@chawyehsu.com> Co-authored-by: Olav Rønnestad Birkeland <6450056+o-l-a-v@users.noreply.github.com> Co-authored-by: kiennq <kien.n.quang@gmail.com> Co-authored-by: HUMORCE <humorce@outlook.com> Co-authored-by: Ryan <sitiom@proton.me> Co-authored-by: Chawye Hsu <su+git@chawyehsu.com> Co-authored-by: Bassel Rachid <101208715+basselworkforce@users.noreply.github.com> Co-authored-by: Wordless Echo <wordless@echo.moe>
140 lines
5.1 KiB
PowerShell
140 lines
5.1 KiB
PowerShell
# Usage: scoop install <app> [options]
|
|
# Summary: Install apps
|
|
# Help: e.g. The usual way to install an app (uses your local 'buckets'):
|
|
# scoop install git
|
|
#
|
|
# To install a different version of the app
|
|
# (note that this will auto-generate the manifest using current version):
|
|
# scoop install gh@2.7.0
|
|
#
|
|
# To install an app from a manifest at a URL:
|
|
# scoop install https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/runat.json
|
|
#
|
|
# To install a different version of the app from a URL:
|
|
# scoop install https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/neovim.json@0.9.0
|
|
#
|
|
# To install an app from a manifest on your computer
|
|
# scoop install \path\to\app.json
|
|
#
|
|
# To install an app from a manifest on your computer
|
|
# scoop install \path\to\app.json@version
|
|
#
|
|
# Options:
|
|
# -g, --global Install the app globally
|
|
# -i, --independent Don't install dependencies automatically
|
|
# -k, --no-cache Don't use the download cache
|
|
# -s, --skip-hash-check Skip hash validation (use with caution!)
|
|
# -u, --no-update-scoop Don't update Scoop before installing if it's outdated
|
|
# -a, --arch <32bit|64bit|arm64> Use the specified architecture, if the app supports it
|
|
|
|
. "$PSScriptRoot\..\lib\getopt.ps1"
|
|
. "$PSScriptRoot\..\lib\json.ps1" # 'autoupdate.ps1' 'manifest.ps1' (indirectly)
|
|
. "$PSScriptRoot\..\lib\autoupdate.ps1" # 'generate_user_manifest' (indirectly)
|
|
. "$PSScriptRoot\..\lib\manifest.ps1" # 'generate_user_manifest' 'Get-Manifest' 'Select-CurrentVersion' (indirectly)
|
|
. "$PSScriptRoot\..\lib\system.ps1"
|
|
. "$PSScriptRoot\..\lib\install.ps1"
|
|
. "$PSScriptRoot\..\lib\download.ps1"
|
|
. "$PSScriptRoot\..\lib\decompress.ps1"
|
|
. "$PSScriptRoot\..\lib\shortcuts.ps1"
|
|
. "$PSScriptRoot\..\lib\psmodules.ps1"
|
|
. "$PSScriptRoot\..\lib\versions.ps1"
|
|
. "$PSScriptRoot\..\lib\depends.ps1"
|
|
if (get_config USE_SQLITE_CACHE) {
|
|
. "$PSScriptRoot\..\lib\database.ps1"
|
|
}
|
|
|
|
$opt, $apps, $err = getopt $args 'giksua:' 'global', 'independent', 'no-cache', 'skip-hash-check', 'no-update-scoop', 'arch='
|
|
if ($err) { "scoop install: $err"; exit 1 }
|
|
|
|
$global = $opt.g -or $opt.global
|
|
$check_hash = !($opt.s -or $opt.'skip-hash-check')
|
|
$independent = $opt.i -or $opt.independent
|
|
$use_cache = !($opt.k -or $opt.'no-cache')
|
|
$architecture = Get-DefaultArchitecture
|
|
try {
|
|
$architecture = Format-ArchitectureString ($opt.a + $opt.arch)
|
|
} catch {
|
|
abort "ERROR: $_"
|
|
}
|
|
|
|
if (!$apps) { error '<app> missing'; my_usage; exit 1 }
|
|
|
|
if ($global -and !(is_admin)) {
|
|
abort 'ERROR: you need admin rights to install global apps'
|
|
}
|
|
|
|
if (is_scoop_outdated) {
|
|
if ($opt.u -or $opt.'no-update-scoop') {
|
|
warn "Scoop is out of date."
|
|
} else {
|
|
& "$PSScriptRoot\scoop-update.ps1"
|
|
}
|
|
}
|
|
|
|
ensure_none_failed $apps
|
|
|
|
if ($apps.length -eq 1) {
|
|
$app, $null, $version = parse_app $apps
|
|
if ($app.EndsWith('.json')) {
|
|
$app = [System.IO.Path]::GetFileNameWithoutExtension($app)
|
|
}
|
|
$curVersion = Select-CurrentVersion -AppName $app -Global:$global
|
|
if ($null -eq $version -and $curVersion) {
|
|
warn "'$app' ($curVersion) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version."
|
|
exit 0
|
|
}
|
|
}
|
|
|
|
# get any specific versions that we need to handle first
|
|
$specific_versions = $apps | Where-Object {
|
|
$null, $null, $version = parse_app $_
|
|
return $null -ne $version
|
|
}
|
|
|
|
# compare object does not like nulls
|
|
if ($specific_versions.Count -gt 0) {
|
|
$difference = Compare-Object -ReferenceObject $apps -DifferenceObject $specific_versions -PassThru
|
|
} else {
|
|
$difference = $apps
|
|
}
|
|
|
|
$specific_versions_paths = $specific_versions | ForEach-Object {
|
|
$app, $bucket, $version = parse_app $_
|
|
if (installed_manifest $app $version) {
|
|
warn "'$app' ($version) is already installed.`nUse 'scoop update $app$(if ($global) { ' --global' })' to install a new version."
|
|
continue
|
|
}
|
|
|
|
generate_user_manifest $app $bucket $version
|
|
}
|
|
$apps = @((@($specific_versions_paths) + $difference) | Where-Object { $_ } | Select-Object -Unique)
|
|
|
|
# remember which were explictly requested so that we can
|
|
# differentiate after dependencies are added
|
|
$explicit_apps = $apps
|
|
|
|
if (!$independent) {
|
|
$apps = $apps | Get-Dependency -Architecture $architecture | Select-Object -Unique # adds dependencies
|
|
}
|
|
ensure_none_failed $apps
|
|
|
|
$apps, $skip = prune_installed $apps $global
|
|
|
|
$skip | Where-Object { $explicit_apps -contains $_ } | ForEach-Object {
|
|
$app, $null, $null = parse_app $_
|
|
$version = Select-CurrentVersion -AppName $app -Global:$global
|
|
warn "'$app' ($version) is already installed. Skipping."
|
|
}
|
|
|
|
$suggested = @{ };
|
|
if ((Test-Aria2Enabled) -and (get_config 'aria2-warning-enabled' $true)) {
|
|
warn "Scoop uses 'aria2c' for multi-connection downloads."
|
|
warn "Should it cause issues, run 'scoop config aria2-enabled false' to disable it."
|
|
warn "To disable this warning, run 'scoop config aria2-warning-enabled false'."
|
|
}
|
|
$apps | ForEach-Object { install_app $_ $architecture $global $suggested $use_cache $check_hash }
|
|
|
|
show_suggestions $suggested
|
|
|
|
exit 0
|