From 657dfb76fa07ba86b6461433c5659adb62ef6218 Mon Sep 17 00:00:00 2001 From: Divam Date: Tue, 4 Jun 2024 15:59:54 +0900 Subject: [PATCH] Dont use curl by default on Windows bootstrap scripts --- docs/guide.md | 6 +----- scripts/bootstrap/bootstrap-haskell.ps1 | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 560e998f..ec26f112 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -791,8 +791,4 @@ There are two known workarounds: 1. Tell curl to ignore certificate errors (dangerous): `curl -k https://raw.githubusercontent.com/haskell/ghcup-hs/master/scripts/bootstrap/bootstrap-haskell | GHCUP_CURL_OPTS="-k" sh` 2. Try to use wget instead: `wget -O /dev/stdout https://raw.githubusercontent.com/haskell/ghcup-hs/master/scripts/bootstrap/bootstrap-haskell | BOOTSTRAP_HASKELL_DOWNLOADER=wget sh` -On windows, you can disable curl like so: - -```pwsh -Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;try { Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true,$false,$false,$false,$false,$false,$false,"","","","",$true } catch { Write-Error $_ } -``` +On windows by default curl is disabled. diff --git a/scripts/bootstrap/bootstrap-haskell.ps1 b/scripts/bootstrap/bootstrap-haskell.ps1 index c300b74e..0231f8f1 100644 --- a/scripts/bootstrap/bootstrap-haskell.ps1 +++ b/scripts/bootstrap/bootstrap-haskell.ps1 @@ -37,8 +37,8 @@ param ( [string]$ExistingMsys2Dir, # Specify the cabal root directory (default: '$InstallDir\cabal') [string]$CabalDir, - # Whether to disable use of curl.exe - [switch]$DisableCurl, + # Whether to use curl.exe (default: false) + [switch]$UseCurl, # The Msys2 version to download (e.g. 20221216) [string]$Msys2Version, # The Msys2 sha256sum hash @@ -504,7 +504,7 @@ if (!(Test-Path -Path ('{0}' -f $MsysDir))) { $msysUrl = ('https://downloads.haskell.org/ghcup/msys2/{0}' -f "$archive") $archivePath = ('{0}\{1}' -f ([IO.Path]::GetTempPath()), "$archive") - if ((Get-Command -Name 'curl.exe' -ErrorAction SilentlyContinue) -and !($DisableCurl)) { + if (($UseCurl) -and (Get-Command -Name 'curl.exe' -ErrorAction SilentlyContinue)) { Exec "curl.exe" '-o' "$archivePath" "$msysUrl" } else { Get-FileWCSynchronous -url "$msysUrl" -destinationFolder ([IO.Path]::GetTempPath()) -includeStats @@ -681,7 +681,7 @@ if ($Minimal) { $MinimalExport = 'export BOOTSTRAP_HASKELL_MINIMAL=1 ;' } -if ($DisableCurl) { +if (!($UseCurl)) { $BootstrapDownloader = 'export BOOTSTRAP_HASKELL_DOWNLOADER=wget ;' $DownloadScript = 'wget -O /dev/stdout' } else {