3 # this allows us to call ps1 files, which allows us to have spaces in filenames
4 # ('powershell "$Env:USERPROFILE\test.ps1" foo' will fail if it has a space in
5 # the path but '& "$Env:USERPROFILE\test.ps1" foo' will work even with a space)
6 Set-ExecutionPolicy -Scope Process Bypass
8 # If a command returns an error, halt the script.
9 $ErrorActionPreference = 'Stop'
11 # Ignore progress events from cmdlets so Invoke-WebRequest is not painfully slow
12 $ProgressPreference = 'SilentlyContinue'
14 $Env:WEBI_HOST = 'https://webinstall.dev'
15 #$Env:WEBI_PKG = 'node@lts'
17 #$Env:WEBI_VERSION = v12.16.2
18 #$Env:WEBI_PKG_URL = "https://.../node-....zip"
19 #$Env:WEBI_PKG_FILE = "node-v12.16.2-win-x64.zip"
21 # Switch to userprofile
22 pushd $Env:USERPROFILE
24 # Make paths if needed
25 if (!(Test-Path -Path Downloads))
27 New-Item -Path Downloads -ItemType Directory
29 if (!(Test-Path -Path .local\bin))
31 New-Item -Path .local\bin -ItemType Directory
33 if (!(Test-Path -Path .local\opt))
35 New-Item -Path .local\opt -ItemType Directory
41 function webi_add_path
43 & "$Env:USERPROFILE\.local\bin\pathman.exe" add "$args[0]"
44 # Note: not all of these work as expected, so we use the unix-style, which is most consistent
45 #& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin
46 #& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\.local\bin"
47 #& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\.local\bin
50 # Run pathman to set up the folder
51 & "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin