refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / _webi / webi.bat
1 @echo off
2 pushd "%userprofile%" || goto :error
3   IF NOT EXIST .local (
4     mkdir .local || goto :error
5   )
6   IF NOT EXIST .local\bin (
7     mkdir .local\bin || goto :error
8   )
9   IF NOT EXIST .local\opt (
10     mkdir .local\opt || goto :error
11   )
12
13   pushd .local\bin || goto :error
14     if NOT EXIST pathman.exe (
15       echo updating PATH management
16       powershell $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://webinstall.dev/packages/pathman/install.bat -OutFile pathman-setup.bat || goto :error
17       call .\pathman-setup.bat || goto :error
18       del pathman-setup.bat  || goto :error
19       rem TODO there's rumor of a windows tool called 'pathman' that does the same thing?
20     )
21   popd || goto :error
22   .\.local\bin\pathman add ".local\bin" || goto :error
23
24   echo downloading and installing %1
25   powershell $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://webinstall.dev/packages/%1/install.ps1 -OutFile %1-webinstall.bat || goto :error
26
27   rem TODO only add if it's not in there already
28   PATH .local\bin;%PATH%
29
30   call %1-webinstall.bat || goto :error
31   del %1-webinstall.bat || goto :error
32 popd
33
34 goto :EOF
35
36 :error
37 echo Failed with error #%errorlevel%.
38 exit /b %errorlevel%