mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
34 lines
1002 B
Bash
34 lines
1002 B
Bash
#!/bin/bash
|
|
################################################################################
|
|
## File: powershellcore.sh
|
|
## Desc: Installs powershellcore
|
|
################################################################################
|
|
|
|
# Source the helpers for use with the script
|
|
source $HELPER_SCRIPTS/document.sh
|
|
source $HELPER_SCRIPTS/os.sh
|
|
|
|
# Install Powershell
|
|
if isUbuntu20 ; then
|
|
snap install powershell --classic --channel=edge/useedge
|
|
fi
|
|
|
|
if isUbuntu16 || isUbuntu18 ; then
|
|
apt-get install -y powershell
|
|
fi
|
|
|
|
# Run tests to determine that the software installed as expected
|
|
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
if ! command -v pwsh; then
|
|
echo "pwsh was not installed"
|
|
exit 1
|
|
fi
|
|
if ! pwsh -c 'Write-Host Hello world'; then
|
|
echo "pwsh failed to run"
|
|
exit 1
|
|
fi
|
|
|
|
# Document what was added to the image
|
|
echo "Lastly, documenting what we added to the metadata file"
|
|
DocumentInstalledItem "Powershell ($(pwsh --version))"
|