Last active
May 5, 2022 08:22
-
-
Save lboulard/5482f1dbbd6a12d407e801946179c565 to your computer and use it in GitHub Desktop.
Scoop setup/daily scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SETLOCAL | |
@CD "%~dp0" | |
:: WARNING scoop force exit of batch | |
powershell -C "%~dp0\export.ps1" | |
@IF "x%~1"=="xbatch" GOTO :EOF | |
@:: Pause if not interactive | |
@ECHO %cmdcmdline% | FIND /i "%~0" >NUL | |
@IF NOT ERRORLEVEL 1 PAUSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
$exportFile = "$PSScriptRoot/scoop.export.txt" | |
scoop export | Out-File "${exportFile}.tmp" -Encoding utf8 | |
If (Compare-Object -ReferenceObject $(gc "${exportFile}.tmp") -DifferenceObject (gc "${exportFile}")) { | |
$max = 9 | |
if (Test-Path -Path "${exportFile}.${max}") { | |
Remove-Item -Force -LiteralPath "${exportFile}.${max}"; | |
} | |
for ($i = $max - 1; $i -gt 0; $i--) { | |
if (Test-Path -Path "${exportFile}.${i}") { | |
Move-Item -Force -LiteralPath "${exportFile}.${i}" -Destination "${exportFile}.$(${i} + 1)"; | |
} | |
} | |
if ((Test-Path -Path "${exportFile}") -and ($max -gt 0)) { | |
Move-Item -Force -LiteralPath "${exportFile}" -Destination "${exportFile}.1"; | |
} | |
Move-Item -Force -LiteralPath "${exportFile}.tmp" -Destination "${exportFile}" | |
Write-Host "Saved to ${exportFile}" | |
} Else { | |
Write-Host "No change in apps list" | |
Remove-Item -LiteralPath "${exportFile}.tmp" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
$TLSProtocol = [System.Net.SecurityProtocolType] 'Tls12, Tls13' | |
[System.Net.ServicePointManager]::SecurityProtocol = $TLSProtocol | |
if (-not (Test-Path env:SCOOP)) { | |
$env:SCOOP='C:\Scoop' | |
[environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User') | |
} | |
iwr -useb get.scoop.sh | iex | |
if (-not $?) { throw 'Scoop failed' } | |
if (false) { | |
scoop config aria2-enabled true | |
scoop config aria2-warning-enabled false | |
scoop config aria2-retry-wait 3 | |
scoop config aria2-split 5 | |
scoop config aria2-max-connection-per-server 2 | |
scoop config aria2-min-split-size 20M | |
scoop config aria2-options @('--check-certificate=false') | |
scoop install aria2 | |
} else { | |
scoop config aria2-enabled false | |
scoop config aria2-warning-enabled false | |
} | |
if (-not $?) { throw 'Scoop failed' } | |
scoop bucket add extras | |
if (-not $?) { throw 'Scoop failed' } | |
scoop bucket add java | |
if (-not $?) { throw 'Scoop failed' } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ scoop | |
<https://scoop.sh/> | |
Make sure PowerShell 5 (or later, include PowerShell Core) and .NET Framework 4.5 (or later) | |
are installed. Then run: | |
# Change execution policy for local user | |
Set-ExecutionPolicy RemoteSigned -scope CurrentUser | |
~ Installing Scoop to Custom Directory | |
Assuming the target directory is C:\scoop, in a PowerShell command console, run: | |
Default install path is %USERPROFILE%\scoop. | |
Change installation path with environment variable SCOOP | |
$env:SCOOP='C:\Scoop' | |
[environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User') | |
~ Installing global apps to custom directory | |
Assuming the target directory is C:\apps, in a admin-enabled PowerShell command console, run: | |
$env:SCOOP_GLOBAL='c:\apps' | |
[environment]::setEnvironmentVariable('SCOOP_GLOBAL',$env:SCOOP_GLOBAL,'Machine') | |
# scoop install -g <app> | |
~ Install scoop | |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | |
# or shorter | |
iwr -useb get.scoop.sh | iex | |
~ Configurea aria2 downloader | |
# Not using aria2 | |
scoop config aria2-enabled false | |
scoop config aria2-warning-enabled false | |
# Using aria2 (PowerShell prompt required) | |
scoop install aria2 | |
scoop config aria2-enabled true | |
scoop config aria2-warning-enabled false | |
scoop config aria2-retry-wait 3 | |
scoop config aria2-split 5 | |
scoop config aria2-max-connection-per-server 2 | |
scoop config aria2-min-split-size 20M | |
# scoop config aria2-options @('--check-certificate=false') | |
# scoop config aria2-options @() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
$TLSProtocol = [System.Net.SecurityProtocolType] 'Tls12, Tls13' | |
[System.Net.ServicePointManager]::SecurityProtocol = $TLSProtocol | |
# Required to install recent ojdkbuild8-full | |
scoop install lessmsi | |
if (-not $?) { throw 'Scoop failed' } | |
scoop config MSIEXTRACT_USE_LESSMSI $true | |
if (-not $?) { throw 'Scoop failed' } | |
# Required buckets | |
scoop bucket add java | |
scoop bucket add extras | |
if (-not $?) { throw 'Scoop failed' } | |
$apps = ((gc .\scoop.export.txt) | sls '([\w_-]+)' |% { $_.matches.groups[1].value }) | |
scoop install @apps | |
if (-not $?) { throw 'Scoop failed' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment