install-all.ps1: update an existing bucket first so new apps (e.g. netflix) are picked up

This commit is contained in:
Jonas8272 committed 2026-11-22 06:17:02 +00:00
1 parent a37459a52e
commit 8515acf12e
1 file changed
+19 -12
+19 -12
View File
@@ -5,7 +5,8 @@
.DESCRIPTION .DESCRIPTION
1. Installs Scoop if it is missing. 1. Installs Scoop if it is missing.
2. Installs git through Scoop if it is missing. 2. Installs git through Scoop if it is missing.
3. Adds the Jonas8272 bucket if it is not added yet. 3. Adds the Jonas8272 bucket if it is not added yet, or updates it if it is,
so newly added apps are picked up.
4. Installs every app found in the bucket, one by one. A failing app does 4. Installs every app found in the bucket, one by one. A failing app does
not stop the others, and a summary is printed at the end. not stop the others, and a summary is printed at the end.
@@ -20,7 +21,7 @@
Skip these apps. Skip these apps.
.EXAMPLE .EXAMPLE
.\install-all.ps1 irm https://codefloe.com/Jonas8272/scoop-bucket/raw/branch/master/installations/install-all.ps1 | iex
.EXAMPLE .EXAMPLE
.\install-all.ps1 -Exclude fxsound .\install-all.ps1 -Exclude fxsound
@@ -29,8 +30,7 @@
.\install-all.ps1 -Only mornye,socialstreamninja .\install-all.ps1 -Only mornye,socialstreamninja
.NOTES .NOTES
Run in a normal (non-admin) PowerShell window if Scoop is not installed yet, Run in a normal (non-admin) PowerShell window if Scoop is not installed yet.
because Scoop's installer refuses to run elevated.
#> #>
[CmdletBinding()] [CmdletBinding()]
@@ -54,13 +54,20 @@ function Test-Admin {
return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
} }
$scoopRoot = if ($env:SCOOP) { $env:SCOOP } else { Join-Path $env:USERPROFILE 'scoop' }
# 1. Scoop ------------------------------------------------------------------- # 1. Scoop -------------------------------------------------------------------
if (-not (Test-Command 'scoop')) { if (-not (Test-Command 'scoop')) {
Write-Host 'Scoop not found. Installing Scoop...' -ForegroundColor Cyan Write-Host 'Scoop not found. Installing Scoop...' -ForegroundColor Cyan
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
if (Test-Admin) {
Invoke-Expression "& {$(Invoke-RestMethod -Uri 'https://get.scoop.sh')} -RunAsAdmin"
} else {
Invoke-RestMethod -Uri 'https://get.scoop.sh' | Invoke-Expression Invoke-RestMethod -Uri 'https://get.scoop.sh' | Invoke-Expression
}
$env:PATH = "$env:USERPROFILE\scoop\shims;$env:PATH" # Make scoop available in this session without reopening PowerShell
$env:PATH = "$scoopRoot\shims;$env:PATH"
if (-not (Test-Command 'scoop')) { if (-not (Test-Command 'scoop')) {
throw 'Scoop was installed but is not on PATH. Open a new PowerShell window and run this script again.' throw 'Scoop was installed but is not on PATH. Open a new PowerShell window and run this script again.'
@@ -69,12 +76,12 @@ if (-not (Test-Command 'scoop')) {
Write-Host 'Scoop is already installed.' -ForegroundColor Green Write-Host 'Scoop is already installed.' -ForegroundColor Green
} }
# 2. git (needed to add buckets) --------------------------------------------- # 2. git (needed to add buckets) ----------------------------------------------
if (-not (Test-Command 'git')) { if (-not (Test-Command 'git')) {
Write-Host 'git not found. Installing git through Scoop...' -ForegroundColor Cyan Write-Host 'git not found. Installing git through Scoop...' -ForegroundColor Cyan
scoop install git scoop install git
if ($LASTEXITCODE -ne 0) { throw 'Failed to install git through Scoop.' } if ($LASTEXITCODE -ne 0) { throw 'Failed to install git through Scoop.' }
$env:PATH = "$env:USERPROFILE\scoop\shims;$env:PATH" $env:PATH = "$scoopRoot\shims;$env:PATH"
} else { } else {
Write-Host 'git is already installed.' -ForegroundColor Green Write-Host 'git is already installed.' -ForegroundColor Green
} }
@@ -86,7 +93,8 @@ $existing = scoop bucket list | Where-Object {
if ($existing) { if ($existing) {
$BucketName = $existing.Name $BucketName = $existing.Name
Write-Host "Bucket '$BucketName' is already added." -ForegroundColor Green Write-Host "Bucket '$BucketName' is already added. Updating it..." -ForegroundColor Green
scoop update
} else { } else {
Write-Host "Adding bucket '$BucketName'..." -ForegroundColor Cyan Write-Host "Adding bucket '$BucketName'..." -ForegroundColor Cyan
scoop bucket add $BucketName $BucketUrl scoop bucket add $BucketName $BucketUrl
@@ -94,13 +102,12 @@ if ($existing) {
} }
# 4. Find the apps in the bucket ---------------------------------------------- # 4. Find the apps in the bucket ----------------------------------------------
$root = if ($env:SCOOP) { $env:SCOOP } else { Join-Path $env:USERPROFILE 'scoop' } $bucketDir = Join-Path $scoopRoot "buckets\$BucketName\bucket"
$bucketDir = Join-Path $root "buckets\$BucketName\bucket"
if (-not (Test-Path $bucketDir)) { if (-not (Test-Path $bucketDir)) {
$bucketDir = Join-Path $root "buckets\$BucketName" $bucketDir = Join-Path $scoopRoot "buckets\$BucketName"
} }
if (-not (Test-Path $bucketDir)) { if (-not (Test-Path $bucketDir)) {
throw "Could not find the bucket folder for '$BucketName' under $root." throw "Could not find the bucket folder for '$BucketName' under $scoopRoot."
} }
$manifests = Get-ChildItem -Path $bucketDir -Filter '*.json' -File | Sort-Object Name $manifests = Get-ChildItem -Path $bucketDir -Filter '*.json' -File | Sort-Object Name