1 # If a command returns an error, halt the script.
2 $ErrorActionPreference = 'Stop'
4 # Ignore progress events from cmdlets so Invoke-WebRequest is not painfully slow
5 $ProgressPreference = 'SilentlyContinue'
8 $Env:WEBI_UA = 'Windows/10 amd64'
11 # Switch to userprofile
12 pushd $Env:USERPROFILE
14 # Make paths if needed
15 if (!(Test-Path -Path .local\bin))
17 New-Item -Path .local\bin -ItemType Directory
19 if (!(Test-Path -Path .local\opt))
21 New-Item -Path .local\opt -ItemType Directory
23 # TODO windows version of mktemp -d
24 if (!(Test-Path -Path .local\tmp))
26 New-Item -Path .local\tmp -ItemType Directory
30 # TODO Test-Path variable:global:Env:WEBI_HOST ???
33 $Env:WEBI_HOST = "https://webinstall.dev"
36 if (!(Test-Path -Path .local\bin\pathman.exe))
38 & curl.exe -fsSL -A "$Env:WEBI_UA" "$Env:WEBI_HOST/packages/pathman/install.ps1" -o .\.local\tmp\pathman-setup.ps1
39 powershell .\.local\tmp\pathman-setup.ps1
40 # TODO del .\.local\tmp\pathman-setup.bat
46 # Fetch <whatever>.ps1
47 echo "$Env:WEBI_HOST/packages/$exename/install.ps1"
48 echo "$exename.install.ps1"
51 # Invoke-WebRequest -UserAgent "Windows amd64" "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar" -OutFile ".\.local\tmp\$exename.install.ps1"
52 & curl.exe -fsSL -A "$Env:WEBI_UA" "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar" -o .\.local\tmp\$exename.install.ps1
55 powershell .\.local\tmp\$exename.install.ps1