ref!: make 'pwsh' canonical package for PowerShell Core

This commit is contained in:
AJ ONeal
2023-11-12 02:32:27 -07:00
parent fc8cef1308
commit 0c438aff8f
3 changed files with 17 additions and 9 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
---
title: Microsoft PowerShell
homepage: https://docs.microsoft.com/en-us/powershell/
title: Microsoft PowerShell Core
homepage: https://docs.microsoft.com/powershell/
tagline: |
PowerShell Core is a cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework.
---
+3 -2
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env pwsh
#################
################
# Install pwsh #
#################
################
# Every package should define these variables
$pkg_cmd_name = "pwsh"
@@ -53,4 +53,5 @@ Write-Output " into ${TPath}${pkg_dst}${TReset}"
Remove-Item -Path "$pkg_dst" -Recurse -ErrorAction Ignore | Out-Null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
webi_path_add "$pkg_dst_bin"
& "$pkg_dst_cmd" -V
+12 -5
View File
@@ -2,12 +2,18 @@
set -e
set -u
__init_powershell() {
__init_pwsh() {
pkg_cmd_name="pwsh"
# no ./bin prefix
# note: no ./bin prefix
pkg_src_cmd="$HOME/.local/opt/pwsh-v$WEBI_VERSION/pwsh"
pkg_src_dir="$HOME/.local/opt/pwsh-v$WEBI_VERSION/"
pkg_src="$HOME/.local/opt/pwsh-v$WEBI_VERSION/"
pkg_dst_cmd="$HOME/.local/opt/pwsh/pwsh"
pkg_dst_dir="$HOME/.local/opt/pwsh/"
pkg_dst="$HOME/.local/opt/pwsh/"
pkg_get_current_version() {
# 'pwsh --version' has output in this format:
@@ -22,16 +28,17 @@ __init_powershell() {
mkdir -p "$pkg_src"
mv ./* "$pkg_src"
# symlink powershell to pwsh
# symlink pwsh as powershell
(
cd "$pkg_src" > /dev/null
rm -rf powershell
ln -s pwsh powershell
)
}
pkg_link() {
# rm -f "$HOME/.local/opt/pwsh"
rm -f "$pkg_dst"
rm -rf "$pkg_dst"
# ln -s "$HOME/.local/opt/pwsh-v7.0.2" "$HOME/.local/opt/pwsh"
ln -s "$pkg_src" "$pkg_dst"
@@ -43,4 +50,4 @@ __init_powershell() {
}
}
__init_powershell
__init_pwsh