mirror of
https://github.com/danbulant/deno_install
synced 2026-07-05 11:10:50 +00:00
Use new LLVM target triple filenames
Remove support for non-windows in powershell. I'm very sure no one uses it, it complicates the script, I don't care to maintain it.
This commit is contained in:
parent
f00e5a40a3
commit
89bac80ea3
5 changed files with 45 additions and 112 deletions
17
README.md
17
README.md
|
|
@ -23,13 +23,13 @@ iwr https://deno.land/x/install/install.ps1 -useb | iex
|
||||||
**With Shell:**
|
**With Shell:**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -fsSL https://deno.land/x/install/install.sh | sh -s v0.2.10
|
curl -fsSL https://deno.land/x/install/install.sh | sh -s v0.38.0
|
||||||
```
|
```
|
||||||
|
|
||||||
**With PowerShell:**
|
**With PowerShell:**
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
iwr https://deno.land/x/install/install.ps1 -useb -outf install.ps1; .\install.ps1 v0.2.10
|
iwr https://deno.land/x/install/install.ps1 -useb -outf install.ps1; .\install.ps1 v0.38.0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install via Package Manager
|
## Install via Package Manager
|
||||||
|
|
@ -40,7 +40,7 @@ iwr https://deno.land/x/install/install.ps1 -useb -outf install.ps1; .\install.p
|
||||||
scoop install deno
|
scoop install deno
|
||||||
```
|
```
|
||||||
|
|
||||||
**With [Homebrew](https://brew.sh/):**
|
**With [Homebrew](https://formulae.brew.sh/formula/deno):**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew install deno
|
brew install deno
|
||||||
|
|
@ -59,13 +59,13 @@ choco install deno
|
||||||
```sh
|
```sh
|
||||||
asdf plugin-add deno https://github.com/asdf-community/asdf-deno.git
|
asdf plugin-add deno https://github.com/asdf-community/asdf-deno.git
|
||||||
|
|
||||||
asdf install deno 0.2.10
|
asdf install deno 0.38.0
|
||||||
|
|
||||||
# Activate globally with:
|
# Activate globally with:
|
||||||
asdf global deno 0.2.10
|
asdf global deno 0.38.0
|
||||||
|
|
||||||
# Activate locally in the current folder with:
|
# Activate locally in the current folder with:
|
||||||
asdf local deno 0.2.10
|
asdf local deno 0.38.0
|
||||||
```
|
```
|
||||||
|
|
||||||
**With [Scoop](https://github.com/lukesampson/scoop/wiki/Switching-Ruby-And-Python-Versions):**
|
**With [Scoop](https://github.com/lukesampson/scoop/wiki/Switching-Ruby-And-Python-Versions):**
|
||||||
|
|
@ -105,17 +105,16 @@ scoop reset deno
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
- The Shell installer can be used on Windows via the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about).
|
- The Shell installer can be used on Windows via the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about).
|
||||||
- The PowerShell installer can be used on Linux and Mac thanks to [PowerShell Core](https://docs.microsoft.com/en-us/powershell/scripting).
|
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
### Running scripts is disabled
|
### Running scripts is disabled
|
||||||
|
|
||||||
```
|
```
|
||||||
PS C:\> iwr https://deno.land/x/install/install.ps1 -useb -outf install.ps1; .\install.ps1 v0.2.10
|
PS C:\> iwr https://deno.land/x/install/install.ps1 -useb -outf install.ps1; .\install.ps1 v0.38.0
|
||||||
.\install.ps1 : File C:\install.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
|
.\install.ps1 : File C:\install.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
|
||||||
At line:1 char:71
|
At line:1 char:71
|
||||||
+ ... /x/install/install.ps1 -useb -outf install.ps1; .\install.ps1 v0.2.10
|
+ ... /x/install/install.ps1 -useb -outf install.ps1; .\install.ps1 v0.38.0
|
||||||
+ ~~~~~~~~~~~~~
|
+ ~~~~~~~~~~~~~
|
||||||
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException
|
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException
|
||||||
+ FullyQualifiedErrorId : UnauthorizedAccess
|
+ FullyQualifiedErrorId : UnauthorizedAccess
|
||||||
|
|
|
||||||
74
install.ps1
74
install.ps1
|
|
@ -15,44 +15,16 @@ if ($PSVersionTable.PSEdition -ne 'Core') {
|
||||||
|
|
||||||
$DenoInstall = $env:DENO_INSTALL
|
$DenoInstall = $env:DENO_INSTALL
|
||||||
$BinDir = if ($DenoInstall) {
|
$BinDir = if ($DenoInstall) {
|
||||||
if ($IsWindows) {
|
|
||||||
"$DenoInstall\bin"
|
"$DenoInstall\bin"
|
||||||
} else {
|
|
||||||
"$DenoInstall/bin"
|
|
||||||
}
|
|
||||||
} elseif ($IsWindows) {
|
} elseif ($IsWindows) {
|
||||||
"$Home\.deno\bin"
|
"$Home\.deno\bin"
|
||||||
} else {
|
|
||||||
"$Home/.local/bin"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$Zip = if ($IsWindows) {
|
$DenoZip = "$BinDir\deno.zip"
|
||||||
'zip'
|
|
||||||
} else {
|
|
||||||
'gz'
|
|
||||||
}
|
|
||||||
|
|
||||||
$DenoZip = if ($IsWindows) {
|
$DenoExe = "$BinDir\deno.exe"
|
||||||
"$BinDir\deno.$Zip"
|
|
||||||
} else {
|
|
||||||
"$BinDir/deno.$Zip"
|
|
||||||
}
|
|
||||||
|
|
||||||
$DenoExe = if ($IsWindows) {
|
$Target = 'x86_64-pc-windows-msvc'
|
||||||
"$BinDir\deno.exe"
|
|
||||||
} else {
|
|
||||||
"$BinDir/deno"
|
|
||||||
}
|
|
||||||
|
|
||||||
$OS = if ($IsWindows) {
|
|
||||||
'win'
|
|
||||||
} else {
|
|
||||||
if ($IsMacOS) {
|
|
||||||
'osx'
|
|
||||||
} else {
|
|
||||||
'linux'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# GitHub requires TLS 1.2
|
# GitHub requires TLS 1.2
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
@ -61,7 +33,7 @@ $DenoUri = if (!$Version) {
|
||||||
$Response = Invoke-WebRequest 'https://github.com/denoland/deno/releases' -UseBasicParsing
|
$Response = Invoke-WebRequest 'https://github.com/denoland/deno/releases' -UseBasicParsing
|
||||||
if ($PSVersionTable.PSEdition -eq 'Core') {
|
if ($PSVersionTable.PSEdition -eq 'Core') {
|
||||||
$Response.Links |
|
$Response.Links |
|
||||||
Where-Object { $_.href -like "/denoland/deno/releases/download/*/deno_${OS}_x64.$Zip" } |
|
Where-Object { $_.href -like "/denoland/deno/releases/download/*/deno-${Target}.zip" } |
|
||||||
ForEach-Object { 'https://github.com' + $_.href } |
|
ForEach-Object { 'https://github.com' + $_.href } |
|
||||||
Select-Object -First 1
|
Select-Object -First 1
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -73,12 +45,12 @@ $DenoUri = if (!$Version) {
|
||||||
$HTMLFile.write($ResponseBytes)
|
$HTMLFile.write($ResponseBytes)
|
||||||
}
|
}
|
||||||
$HTMLFile.getElementsByTagName('a') |
|
$HTMLFile.getElementsByTagName('a') |
|
||||||
Where-Object { $_.href -like "about:/denoland/deno/releases/download/*/deno_${OS}_x64.$Zip" } |
|
Where-Object { $_.href -like "about:/denoland/deno/releases/download/*/deno_${Target}.zip" } |
|
||||||
ForEach-Object { $_.href -replace 'about:', 'https://github.com' } |
|
ForEach-Object { $_.href -replace 'about:', 'https://github.com' } |
|
||||||
Select-Object -First 1
|
Select-Object -First 1
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"https://github.com/denoland/deno/releases/download/$Version/deno_${OS}_x64.$Zip"
|
"https://github.com/denoland/deno/releases/download/$Version/deno-${Target}.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(Test-Path $BinDir)) {
|
if (!(Test-Path $BinDir)) {
|
||||||
|
|
@ -87,30 +59,14 @@ if (!(Test-Path $BinDir)) {
|
||||||
|
|
||||||
Invoke-WebRequest $DenoUri -OutFile $DenoZip -UseBasicParsing
|
Invoke-WebRequest $DenoUri -OutFile $DenoZip -UseBasicParsing
|
||||||
|
|
||||||
if ($IsWindows) {
|
Expand-Archive $DenoZip -Destination $BinDir -Force
|
||||||
Expand-Archive $DenoZip -Destination $BinDir -Force
|
Remove-Item $DenoZip
|
||||||
Remove-Item $DenoZip
|
|
||||||
} else {
|
|
||||||
gunzip -df $DenoZip
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($IsWindows) {
|
$User = [EnvironmentVariableTarget]::User
|
||||||
$User = [EnvironmentVariableTarget]::User
|
$Path = [Environment]::GetEnvironmentVariable('Path', $User)
|
||||||
$Path = [Environment]::GetEnvironmentVariable('Path', $User)
|
if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) {
|
||||||
if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) {
|
[Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User)
|
||||||
[Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User)
|
$Env:Path += ";$BinDir"
|
||||||
$Env:Path += ";$BinDir"
|
|
||||||
}
|
|
||||||
Write-Output "Deno was installed successfully to $DenoExe"
|
|
||||||
Write-Output "Run 'deno --help' to get started"
|
|
||||||
} else {
|
|
||||||
chmod +x "$BinDir/deno"
|
|
||||||
Write-Output "Deno was installed successfully to $DenoExe"
|
|
||||||
if (Get-Command deno -ErrorAction SilentlyContinue) {
|
|
||||||
Write-Output "Run 'deno --help' to get started"
|
|
||||||
} else {
|
|
||||||
Write-Output "Manually add the directory to your `$HOME/.bash_profile (or similar)"
|
|
||||||
Write-Output " export PATH=`"${BinDir}:`$PATH`""
|
|
||||||
Write-Output "Run '$DenoExe --help' to get started"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Write-Output "Deno was installed successfully to $DenoExe"
|
||||||
|
Write-Output "Run 'deno --help' to get started"
|
||||||
|
|
|
||||||
21
install.sh
21
install.sh
|
|
@ -5,16 +5,11 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Darwin) os="osx" ;;
|
Darwin) target="x86_64-apple-darwin" ;;
|
||||||
*) os="linux" ;;
|
*) target="x86_64-unknown-linux-gnu" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $(uname -m) in
|
if [ $(uname -m) != "x86_64" ]; then
|
||||||
x86_64) arch="x86_64" ;;
|
|
||||||
*) arch="other" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ "$arch" = "other" ]; then
|
|
||||||
echo "Unsupported architecture $(uname -m). Only x64 binaries are available."
|
echo "Unsupported architecture $(uname -m). Only x64 binaries are available."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
@ -22,13 +17,13 @@ fi
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
deno_asset_path=$(
|
deno_asset_path=$(
|
||||||
command curl -sSf https://github.com/denoland/deno/releases |
|
command curl -sSf https://github.com/denoland/deno/releases |
|
||||||
command grep -o "/denoland/deno/releases/download/.*/deno_${os}_x64\\.gz" |
|
command grep -o "/denoland/deno/releases/download/.*/deno-${target}\\.zip" |
|
||||||
command head -n 1
|
command head -n 1
|
||||||
)
|
)
|
||||||
if [ ! "$deno_asset_path" ]; then exit 1; fi
|
if [ ! "$deno_asset_path" ]; then exit 1; fi
|
||||||
deno_uri="https://github.com${deno_asset_path}"
|
deno_uri="https://github.com${deno_asset_path}"
|
||||||
else
|
else
|
||||||
deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno_${os}_x64.gz"
|
deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno-${target}.zip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deno_install="${DENO_INSTALL:-$HOME/.local}"
|
deno_install="${DENO_INSTALL:-$HOME/.local}"
|
||||||
|
|
@ -39,9 +34,11 @@ if [ ! -d "$bin_dir" ]; then
|
||||||
mkdir -p "$bin_dir"
|
mkdir -p "$bin_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -fL# -o "$exe.gz" "$deno_uri"
|
curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri"
|
||||||
gunzip -df "$exe.gz"
|
cd "$bin_dir"
|
||||||
|
unzip "$exe.zip"
|
||||||
chmod +x "$exe"
|
chmod +x "$exe"
|
||||||
|
rm "$exe.zip"
|
||||||
|
|
||||||
echo "Deno was installed successfully to $exe"
|
echo "Deno was installed successfully to $exe"
|
||||||
if command -v deno >/dev/null; then
|
if command -v deno >/dev/null; then
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
if ($PSVersionTable.PSEdition -ne 'Core') {
|
|
||||||
$IsWindows = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(Get-PSRepository)) {
|
if (!(Get-PSRepository)) {
|
||||||
Register-PSRepository -Default
|
Register-PSRepository -Default
|
||||||
}
|
}
|
||||||
|
|
@ -18,33 +14,18 @@ if (!(Get-Module PSScriptAnalyzer -ListAvailable)) {
|
||||||
Invoke-ScriptAnalyzer *.ps1 -EnableExit -Exclude PSAvoidAssignmentToAutomaticVariable
|
Invoke-ScriptAnalyzer *.ps1 -EnableExit -Exclude PSAvoidAssignmentToAutomaticVariable
|
||||||
|
|
||||||
# Test that we can install the latest version at the default location.
|
# Test that we can install the latest version at the default location.
|
||||||
if ($IsWindows) {
|
Remove-Item "~\.deno" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item "~\.deno" -Recurse -Force -ErrorAction SilentlyContinue
|
|
||||||
} else {
|
|
||||||
Remove-Item "~/.local/bin/deno" -Force -ErrorAction SilentlyContinue
|
|
||||||
}
|
|
||||||
$env:DENO_INSTALL = ""
|
$env:DENO_INSTALL = ""
|
||||||
.\install.ps1
|
.\install.ps1
|
||||||
if ($IsWindows) {
|
~\.deno\bin\deno.exe --version
|
||||||
~\.deno\bin\deno.exe --version
|
|
||||||
} else {
|
|
||||||
~/.local/bin/deno --version
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test that we can install a specific version at a custom location.
|
# Test that we can install a specific version at a custom location.
|
||||||
if ($IsWindows) {
|
Remove-Item "~\deno-0.38.0" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item "~\deno-0.13.0" -Recurse -Force -ErrorAction SilentlyContinue
|
$env:DENO_INSTALL = "$Home\deno-0.38.0"
|
||||||
$env:DENO_INSTALL = "$Home\deno-0.13.0"
|
|
||||||
} else {
|
.\install.ps1 v0.38.0
|
||||||
Remove-Item "~/deno-0.13.0" -Recurse -Force -ErrorAction SilentlyContinue
|
$DenoVersion = ~\deno-0.38.0\bin\deno.exe --version
|
||||||
$env:DENO_INSTALL = "$Home/deno-0.13.0"
|
|
||||||
}
|
if (!($DenoVersion -like '*0.38.0*')) {
|
||||||
.\install.ps1 v0.13.0
|
|
||||||
$DenoVersion = if ($IsWindows) {
|
|
||||||
~\deno-0.13.0\bin\deno.exe --version
|
|
||||||
} else {
|
|
||||||
~/deno-0.13.0/bin/deno --version
|
|
||||||
}
|
|
||||||
if (!($DenoVersion -like '*0.13.0*')) {
|
|
||||||
throw $DenoVersion
|
throw $DenoVersion
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ sh ./install.sh
|
||||||
~/.local/bin/deno --version
|
~/.local/bin/deno --version
|
||||||
|
|
||||||
# Test that we can install a specific version at a custom location.
|
# Test that we can install a specific version at a custom location.
|
||||||
rm -rf ~/deno-0.13.0
|
rm -rf ~/deno-0.38.0
|
||||||
export DENO_INSTALL="$HOME/deno-0.13.0"
|
export DENO_INSTALL="$HOME/deno-0.38.0"
|
||||||
./install.sh v0.13.0
|
./install.sh v0.38.0
|
||||||
~/deno-0.13.0/bin/deno --version | grep 0.13.0
|
~/deno-0.38.0/bin/deno --version | grep 0.38.0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue