-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore(installer): Drop the old installer #5186
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,2 @@ | ||
| #Requires -Version 5 | ||
|
|
||
| # remote install: | ||
| # Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | ||
| $old_erroractionpreference = $erroractionpreference | ||
| $erroractionpreference = 'stop' # quit if anything goes wrong | ||
|
|
||
| if (($PSVersionTable.PSVersion.Major) -lt 5) { | ||
| Write-Output "PowerShell 5 or later is required to run Scoop." | ||
| Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell" | ||
| break | ||
| } | ||
|
|
||
| # show notification to change execution policy: | ||
| $allowedExecutionPolicy = @('Unrestricted', 'RemoteSigned', 'ByPass') | ||
| if ((Get-ExecutionPolicy).ToString() -notin $allowedExecutionPolicy) { | ||
| Write-Output "PowerShell requires an execution policy in [$($allowedExecutionPolicy -join ", ")] to run Scoop." | ||
| Write-Output "For example, to set the execution policy to 'RemoteSigned' please run :" | ||
| Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'" | ||
| break | ||
| } | ||
|
|
||
| if ([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') { | ||
| Write-Output "Scoop requires at least .NET Framework 4.5" | ||
| Write-Output "Please download and install it first:" | ||
| Write-Output "https://www.microsoft.com/net/download" | ||
| break | ||
| } | ||
|
|
||
| # get core functions | ||
| $core_url = 'https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/lib/core.ps1' | ||
| Write-Output 'Initializing...' | ||
| Invoke-Expression (new-object net.webclient).downloadstring($core_url) | ||
|
|
||
| # prep | ||
| if (Get-Command -Name 'scoop' -ErrorAction SilentlyContinue) { | ||
| write-host "Scoop is already installed. Run 'scoop update' to get the latest version." -f red | ||
| # don't abort if invoked with iex that would close the PS session | ||
| if ($myinvocation.mycommand.commandtype -eq 'Script') { return } else { exit 1 } | ||
| } | ||
| $dir = ensure (versiondir 'scoop' 'current') | ||
|
|
||
| # download scoop zip | ||
| $zipUrl = 'https://github.com/ScoopInstaller/Scoop/archive/master.zip' | ||
| $zipFile = "$dir\scoop.zip" | ||
| Write-Output 'Downloading scoop...' | ||
| Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile | ||
|
|
||
| Write-Output 'Extracting...' | ||
| Add-Type -Assembly "System.IO.Compression.FileSystem" | ||
| [IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp") | ||
| Copy-Item "$dir\_tmp\*master\*" $dir -Recurse -Force | ||
| Remove-Item "$dir\_tmp", $zipfile -Recurse -Force | ||
|
|
||
| Write-Output 'Creating shim...' | ||
| shim "$dir\bin\scoop.ps1" $false | ||
|
|
||
| # download main bucket | ||
| $dir = "$scoopdir\buckets\main" | ||
| $zipUrl = 'https://github.com/ScoopInstaller/Main/archive/master.zip' | ||
| $zipFile = "$dir\main-bucket.zip" | ||
| Write-Output 'Downloading main bucket...' | ||
| New-Item -Path $dir -Type Directory -Force | Out-Null | ||
| Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile | ||
|
|
||
| Write-Output 'Extracting...' | ||
| [IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp") | ||
| Copy-Item "$dir\_tmp\*-master\*" $dir -Recurse -Force | ||
| Remove-Item "$dir\_tmp", $zipfile -Recurse -Force | ||
|
|
||
| ensure_robocopy_in_path | ||
|
|
||
| set_config LAST_UPDATE ([System.DateTime]::Now.ToString('o')) | Out-Null | ||
| success 'Scoop was installed successfully!' | ||
|
|
||
| Write-Output "Type 'scoop help' for instructions." | ||
|
|
||
| $erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value | ||
| irm get.scoop.sh | iex | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.