Skip to content

Commit aba8429

Browse files
committed
Fix #2545 install pwsh fail on ubuntu-25.04
1 parent 75536de commit aba8429

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

1k/install-pwsh.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,20 @@ elif [ $HOST_OS = 'Linux' ] ; then
5959
if command -v dpkg > /dev/null; then # Linux distro: deb (ubuntu)
6060
sudo_cmd=$(which sudo)
6161
$sudo_cmd apt update
62-
$sudo_cmd apt install curl
62+
$sudo_cmd apt --fix-broken install
6363
check_pwsh $pwsh_min_ver $preferred_ver
64-
pwsh_pkg="powershell_$pwsh_ver-1.deb_amd64.deb"
65-
pwsh_pkg_out="$cacheDir/$pwsh_pkg"
66-
if [ ! -f "$pwsh_pkg_out" ] ; then
67-
curl -L "https://github.com/PowerShell/PowerShell/releases/download/v$pwsh_ver/$pwsh_pkg" -o "$pwsh_pkg_out"
64+
if uname -a | grep -q "Ubuntu"; then
65+
$sudo_cmd snap install powershell --classic
66+
else
67+
$sudo_cmd apt install curl
68+
pwsh_pkg="powershell_$pwsh_ver-1.deb_amd64.deb"
69+
pwsh_pkg_out="$cacheDir/$pwsh_pkg"
70+
if [ ! -f "$pwsh_pkg_out" ] ; then
71+
curl -L "https://github.com/PowerShell/PowerShell/releases/download/v$pwsh_ver/$pwsh_pkg" -o "$pwsh_pkg_out"
72+
fi
73+
$sudo_cmd dpkg -i --ignore-depends=libicu72 "$pwsh_pkg_out"
74+
$sudo_cmd apt install -f powershell
6875
fi
69-
$sudo_cmd dpkg -i --ignore-depends=libicu72 "$pwsh_pkg_out"
70-
$sudo_cmd apt-get install -f powershell
7176
elif command -v pacman > /dev/null; then # Linux distro: Arch
7277
# refer: https://ephos.github.io/posts/2018-9-17-Pwsh-ArchLinux
7378
# available pwsh version, refer to: https://aur.archlinux.org/packages/powershell-bin

0 commit comments

Comments
 (0)