Skip to content

Commit 223439c

Browse files
chawyehsuniheaven
authored andcommitted
chore(installer): Drop the old installer (ScoopInstaller#5186)
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
1 parent 33f6a8c commit 223439c

2 files changed

Lines changed: 2 additions & 77 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Code Refactoring
88

99
- **hash:** Use `Get-FileHash()` directly ([#5177](https://github.com/ScoopInstaller/Scoop/issues/5177))
10+
- **installer:** Drop the old installer ([#5186](https://github.com/ScoopInstaller/Scoop/issues/5186))
1011

1112
## [v0.3.0](https://github.com/ScoopInstaller/Scoop/compare/v0.2.4...v0.3.0) - 2022-10-10
1213

bin/install.ps1

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,2 @@
11
#Requires -Version 5
2-
3-
# remote install:
4-
# Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
5-
$old_erroractionpreference = $erroractionpreference
6-
$erroractionpreference = 'stop' # quit if anything goes wrong
7-
8-
if (($PSVersionTable.PSVersion.Major) -lt 5) {
9-
Write-Output "PowerShell 5 or later is required to run Scoop."
10-
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
11-
break
12-
}
13-
14-
# show notification to change execution policy:
15-
$allowedExecutionPolicy = @('Unrestricted', 'RemoteSigned', 'ByPass')
16-
if ((Get-ExecutionPolicy).ToString() -notin $allowedExecutionPolicy) {
17-
Write-Output "PowerShell requires an execution policy in [$($allowedExecutionPolicy -join ", ")] to run Scoop."
18-
Write-Output "For example, to set the execution policy to 'RemoteSigned' please run :"
19-
Write-Output "'Set-ExecutionPolicy RemoteSigned -scope CurrentUser'"
20-
break
21-
}
22-
23-
if ([System.Enum]::GetNames([System.Net.SecurityProtocolType]) -notcontains 'Tls12') {
24-
Write-Output "Scoop requires at least .NET Framework 4.5"
25-
Write-Output "Please download and install it first:"
26-
Write-Output "https://www.microsoft.com/net/download"
27-
break
28-
}
29-
30-
# get core functions
31-
$core_url = 'https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/lib/core.ps1'
32-
Write-Output 'Initializing...'
33-
Invoke-Expression (new-object net.webclient).downloadstring($core_url)
34-
35-
# prep
36-
if (Get-Command -Name 'scoop' -ErrorAction SilentlyContinue) {
37-
write-host "Scoop is already installed. Run 'scoop update' to get the latest version." -f red
38-
# don't abort if invoked with iex that would close the PS session
39-
if ($myinvocation.mycommand.commandtype -eq 'Script') { return } else { exit 1 }
40-
}
41-
$dir = ensure (versiondir 'scoop' 'current')
42-
43-
# download scoop zip
44-
$zipUrl = 'https://github.com/ScoopInstaller/Scoop/archive/master.zip'
45-
$zipFile = "$dir\scoop.zip"
46-
Write-Output 'Downloading scoop...'
47-
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile
48-
49-
Write-Output 'Extracting...'
50-
Add-Type -Assembly "System.IO.Compression.FileSystem"
51-
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp")
52-
Copy-Item "$dir\_tmp\*master\*" $dir -Recurse -Force
53-
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force
54-
55-
Write-Output 'Creating shim...'
56-
shim "$dir\bin\scoop.ps1" $false
57-
58-
# download main bucket
59-
$dir = "$scoopdir\buckets\main"
60-
$zipUrl = 'https://github.com/ScoopInstaller/Main/archive/master.zip'
61-
$zipFile = "$dir\main-bucket.zip"
62-
Write-Output 'Downloading main bucket...'
63-
New-Item -Path $dir -Type Directory -Force | Out-Null
64-
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile
65-
66-
Write-Output 'Extracting...'
67-
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp")
68-
Copy-Item "$dir\_tmp\*-master\*" $dir -Recurse -Force
69-
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force
70-
71-
ensure_robocopy_in_path
72-
73-
set_config LAST_UPDATE ([System.DateTime]::Now.ToString('o')) | Out-Null
74-
success 'Scoop was installed successfully!'
75-
76-
Write-Output "Type 'scoop help' for instructions."
77-
78-
$erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value
2+
Invoke-RestMethod https://get.scoop.sh | Invoke-Expression

0 commit comments

Comments
 (0)