@@ -4,9 +4,9 @@ Set-ExecutionPolicy -Scope Process Bypass
4
4
$ErrorActionPreference = ' Stop'
5
5
$ProgressPreference = ' SilentlyContinue'
6
6
7
- $my_version = ' v1.1.16 '
7
+ $my_version = ' v1.2.0 '
8
8
9
- IF ($null -eq $ Env: WEBI_HOST -or $ Env: WEBI_HOST - eq " " ) {
9
+ IF ($Env: WEBI_HOST.Length - eq 0 ) {
10
10
$Env: WEBI_HOST = " https://webinstall.dev"
11
11
}
12
12
@@ -64,20 +64,25 @@ function Get-UserAgent {
64
64
" Windows/10+ $my_arch msvc"
65
65
}
66
66
67
- # Make paths if needed
68
- # TODO replace all bin with opt\bin\
69
- New-Item - Path " $HOME \.local\bin\" - ItemType Directory - Force | Out-Null
67
+ function Install-Webi {
68
+ # Make paths if needed
69
+ # TODO replace all bin with opt\bin\
70
+ $null = New-Item - Path " $HOME \.local\bin\" - ItemType Directory - Force
71
+ $null = New-Item - Path " $HOME \.local\opt\" - ItemType Directory - Force
70
72
71
- # See note on Set-ExecutionPolicy above
72
- Set-Content - Path " $HOME \.local\bin\webi.bat" - Value " @echo off`r`n powershell -ExecutionPolicy Bypass %USERPROFILE%\.local\bin\webi-pwsh.ps1 %*"
73
- # Backwards-compat bugfix: remove old webi-pwsh.ps1 location
74
- Remove-Item - Path " $HOME \.local\bin\webi.ps1" - Recurse - ErrorAction Ignore
75
- if (! (Test-Path - Path " $HOME \.local\opt" )) {
76
- New-Item - Path " $HOME \.local\opt" - ItemType Directory - Force | Out-Null
77
- }
78
- # TODO windows version of mktemp -d
79
- if (! (Test-Path - Path " $HOME \.local\tmp" )) {
80
- New-Item - Path " $HOME \.local\tmp" - ItemType Directory - Force | Out-Null
73
+ # See note on Set-ExecutionPolicy above
74
+ Set-Content - Path " $HOME \.local\bin\webi.bat" - Value " @echo off`r`n powershell -ExecutionPolicy Bypass %USERPROFILE%\.local\bin\webi-pwsh.ps1 %*"
75
+
76
+ # Backwards-compat bugfix: remove old webi-pwsh.ps1 location
77
+ Remove-Item - Path " $HOME \.local\bin\webi.ps1" - Recurse - ErrorAction Ignore
78
+
79
+ # TODO windows version of mktemp -d
80
+ IF (Test-Path - Path " $HOME \.local\tmp" ) {
81
+ Write-Host " Found $HOME \.local\tmp\"
82
+ } ELSE {
83
+ Write-Host " Creating $HOME \.local\tmp\"
84
+ $null = New-Item - Path " $HOME \.local\tmp" - ItemType Directory - Force | Out-Null
85
+ }
81
86
}
82
87
83
88
# # show help if no params given or help flags are used
@@ -125,4 +130,4 @@ $PKG_URL = "$Env:WEBI_HOST/api/installers/$exename.ps1?$Formats&$Libc"
125
130
Invoke-DownloadUrl - URL $PKG_URL - Path $HOME \.local\tmp\$exename.install.ps1
126
131
127
132
# Run <whatever>.ps1
128
- & " $HOME \.local\tmp\${exename} .install.ps1"
133
+ & $HOME \.local\tmp\${exename}.install.ps1
0 commit comments