-
Notifications
You must be signed in to change notification settings - Fork 8
/
0install.ps1
35 lines (32 loc) · 1.1 KB
/
0install.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$ErrorActionPreference = "Stop"
function Download-ZeroInstall {
$dir = "$env:LOCALAPPDATA\0install.net\bootstrapper"
$file = "$dir\0install.exe"
if (!(Test-Path $file)) {
mkdir -Force $dir | Out-Null
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12'
Invoke-WebRequest "https://get.0install.net/0install.exe" -OutFile $file
}
return $file
}
function Run-ZeroInstall {
if (Get-Command 0install -ErrorAction SilentlyContinue) {
0install @args
} else {
. $(Download-ZeroInstall) @args
}
}
if ($args.Count -eq 0) {
echo "This script runs 0install from your PATH or downloads it on-demand."
echo ""
echo "To run 0install commands without adding 0install to your PATH:"
echo ".\0install.ps1 COMMAND [OPTIONS]"
echo ""
echo "To deploy 0install to your user profile:"
echo ".\0install.ps1 self deploy"
echo ""
echo "To deploy 0install to your machine:"
echo ".\0install.ps1 self deploy --machine"
} else {
Run-ZeroInstall @args
}