mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-06-01 21:42:58 +00:00
Compare commits
2 Commits
copilot/fi
...
copilot/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76c957e8d2 | ||
|
|
97fc71a066 |
@@ -7,6 +7,11 @@
|
||||
New-Item -Path "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | Out-Null
|
||||
New-Item -Path "$Env:USERPROFILE\.local\bin" -ItemType Directory -Force | Out-Null
|
||||
if ($null -eq $Env:WEBI_HOST -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
|
||||
curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1" -o "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1"
|
||||
$b_webi_ps1 = "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1"
|
||||
curl.exe -s -A "windows" "$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1" | Out-File -Encoding utf8 "$b_webi_ps1"
|
||||
if ($LASTEXITCODE -ne 0 -or -not (Test-Path "$b_webi_ps1") -or (Get-Item "$b_webi_ps1").Length -lt 100) {
|
||||
Write-Error "error: failed to download '$Env:WEBI_HOST/packages/webi/webi-pwsh.ps1'"
|
||||
exit 1
|
||||
}
|
||||
Set-ExecutionPolicy -Scope Process Bypass
|
||||
& "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" "{{ exename }}"
|
||||
& "$b_webi_ps1" "{{ exename }}"
|
||||
|
||||
@@ -3,6 +3,7 @@ set -e
|
||||
set -u
|
||||
|
||||
GOBIN="${HOME}/go"
|
||||
GOBIN_REAL="${HOME}/.local/opt/go-bin-v${WEBI_VERSION}"
|
||||
|
||||
pkg_cmd_name="go"
|
||||
|
||||
@@ -36,43 +37,13 @@ pkg_link() {
|
||||
rm -rf "$pkg_dst"
|
||||
ln -s "$pkg_src" "$pkg_dst"
|
||||
|
||||
# Go's package directory (GOPATH) at ~/go must persist across version
|
||||
# upgrades. Unlike other tools, go-installed binaries are shared across
|
||||
# all Go versions, so ~/go is kept stable rather than being swapped to a
|
||||
# versioned directory on each upgrade.
|
||||
b_gobin_stable="${HOME}/.local/opt/go-bin"
|
||||
# Go has a special $GOBIN
|
||||
|
||||
# New install: create ~/go as a real directory (not a symlink)
|
||||
if ! test -e "$GOBIN" && ! test -L "$GOBIN"; then
|
||||
mkdir -p "$GOBIN/bin"
|
||||
return
|
||||
fi
|
||||
|
||||
# Real directory: leave it alone
|
||||
if ! test -L "$GOBIN"; then
|
||||
return
|
||||
fi
|
||||
|
||||
b_old_target="$(readlink "$GOBIN")"
|
||||
|
||||
# Already pointing to the stable unversioned dir: nothing to do
|
||||
if test "$b_old_target" = "$b_gobin_stable"; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Migrate from old versioned-symlink (e.g. go-bin-v1.14.2):
|
||||
# rename the versioned directory to the stable unversioned path
|
||||
# so that all installed tools are preserved on upgrade.
|
||||
if test -d "$b_old_target"; then
|
||||
mv "$b_old_target" "$b_gobin_stable"
|
||||
rm -f "$GOBIN"
|
||||
ln -s "$b_gobin_stable" "$GOBIN"
|
||||
return
|
||||
fi
|
||||
|
||||
# Symlink target is gone; recreate ~/go as a real directory
|
||||
rm -f "$GOBIN"
|
||||
mkdir -p "$GOBIN/bin"
|
||||
# 'GOBIN' is set above to "${HOME}/go"
|
||||
# 'GOBIN_REAL' will be "${HOME}/.local/opt/go-bin-v${WEBI_VERSION}"
|
||||
rm -rf "$GOBIN"
|
||||
mkdir -p "$GOBIN_REAL/bin"
|
||||
ln -s "$GOBIN_REAL" "$GOBIN"
|
||||
}
|
||||
|
||||
pkg_post_install() {
|
||||
|
||||
@@ -3,6 +3,7 @@ set -e
|
||||
set -u
|
||||
|
||||
GOBIN="${HOME}/go"
|
||||
GOBIN_REAL="${HOME}/.local/opt/go-bin-v${WEBI_VERSION}"
|
||||
|
||||
pkg_cmd_name="go"
|
||||
|
||||
@@ -36,43 +37,13 @@ pkg_link() {
|
||||
rm -rf "$pkg_dst"
|
||||
ln -s "$pkg_src" "$pkg_dst"
|
||||
|
||||
# Go's package directory (GOPATH) at ~/go must persist across version
|
||||
# upgrades. Unlike other tools, go-installed binaries are shared across
|
||||
# all Go versions, so ~/go is kept stable rather than being swapped to a
|
||||
# versioned directory on each upgrade.
|
||||
b_gobin_stable="${HOME}/.local/opt/go-bin"
|
||||
# Go has a special $GOBIN
|
||||
|
||||
# New install: create ~/go as a real directory (not a symlink)
|
||||
if ! test -e "$GOBIN" && ! test -L "$GOBIN"; then
|
||||
mkdir -p "$GOBIN/bin"
|
||||
return
|
||||
fi
|
||||
|
||||
# Real directory: leave it alone
|
||||
if ! test -L "$GOBIN"; then
|
||||
return
|
||||
fi
|
||||
|
||||
b_old_target="$(readlink "$GOBIN")"
|
||||
|
||||
# Already pointing to the stable unversioned dir: nothing to do
|
||||
if test "$b_old_target" = "$b_gobin_stable"; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Migrate from old versioned-symlink (e.g. go-bin-v1.14.2):
|
||||
# rename the versioned directory to the stable unversioned path
|
||||
# so that all installed tools are preserved on upgrade.
|
||||
if test -d "$b_old_target"; then
|
||||
mv "$b_old_target" "$b_gobin_stable"
|
||||
rm -f "$GOBIN"
|
||||
ln -s "$b_gobin_stable" "$GOBIN"
|
||||
return
|
||||
fi
|
||||
|
||||
# Symlink target is gone; recreate ~/go as a real directory
|
||||
rm -f "$GOBIN"
|
||||
mkdir -p "$GOBIN/bin"
|
||||
# 'GOBIN' is set above to "${HOME}/go"
|
||||
# 'GOBIN_REAL' will be "${HOME}/.local/opt/go-bin-v${WEBI_VERSION}"
|
||||
rm -rf "$GOBIN"
|
||||
mkdir -p "$GOBIN_REAL/bin"
|
||||
ln -s "$GOBIN_REAL" "$GOBIN"
|
||||
}
|
||||
|
||||
pkg_post_install() {
|
||||
|
||||
Reference in New Issue
Block a user