3 # If a command returns an error, halt the script.
4 $ErrorActionPreference = 'Stop'
6 # Ignore progress events from cmdlets so Invoke-WebRequest is not painfully slow
7 $ProgressPreference = 'SilentlyContinue'
9 $Env:WEBI_HOST = 'https://webinstall.dev'
10 #$Env:WEBI_PKG = 'node@lts'
12 #$Env:WEBI_VERSION = v12.16.2
13 #$Env:WEBI_PKG_URL = "https://.../node-....zip"
14 #$Env:WEBI_PKG_FILE = "node-v12.16.2-win-x64.zip"
16 # Switch to userprofile
17 pushd $Env:USERPROFILE
19 # Make paths if needed
20 if (!(Test-Path -Path Downloads))
22 New-Item -Path Downloads -ItemType Directory
24 if (!(Test-Path -Path .local\bin))
26 New-Item -Path .local\bin -ItemType Directory
28 if (!(Test-Path -Path .local\opt))
30 New-Item -Path .local\opt -ItemType Directory
36 function webi_add_path
38 & "$Env:USERPROFILE\.local\bin\pathman.exe" add "$args[0]"
39 # Note: not all of these work as expected, so we use the unix-style, which is most consistent
40 #& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
41 #& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\.local\bin"
42 #& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\.local\bin
45 # Run pathman to set up the folder
46 & "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin