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
29 if (!(Test-Path -Path .local\bin\pathman.exe))
31 & curl.exe -fsSL -A "$Env:WEBI_UA" "$Env:WEBI_HOST/packages/pathman/install.ps1" -o .\.local\tmp\pathman-setup.ps1
32 powershell .\.local\tmp\pathman-setup.ps1
33 # TODO del .\.local\tmp\pathman-setup.bat
39 # Fetch <whatever>.ps1
40 echo "$Env:WEBI_HOST/packages/$exename/install.ps1"
41 echo "$exename.install.ps1"
44 # Invoke-WebRequest -UserAgent "Windows amd64" "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar" -OutFile ".\.local\tmp\$exename.install.ps1"
45 & curl.exe -fsSL -A "$Env:WEBI_UA" "$Env:WEBI_HOST/api/installers/$exename.ps1?formats=zip,tar" -o .\.local\tmp\$exename.install.ps1
48 powershell .\.local\tmp\$exename.install.ps1