-
Notifications
You must be signed in to change notification settings - Fork 1
/
powershell.sh
executable file
·38 lines (27 loc) · 1.12 KB
/
powershell.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
set -euo pipefail
trap "echo 'error: Script failed: see failed command above'" ERR
DIR=$(cd "$(dirname "$0")" && pwd)
source "$DIR/.lib.sh"
# https://docs.microsoft.com/en-us/powershell/scripting/install/install-ubuntu?view=powershell-7.2#installation-via-package-repository
# apt-cache madison powershell | head -n 40
# apt list update && apt list -a powershell
start "PowerShell (ubuntu-2204)"
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
# Install PowerShell
sudo apt-get install -y powershell
# Cleanup
rm packages-microsoft-prod.deb
# Install modules
pwsh --command "Install-Module -Name posh-git, PSReadLine -Verbose"
pwsh --command "Get-Module"
end 'pwsh' '--version'