#!/bin/bash set -Eeuxo pipefail printf "\n\tšŸ‹ Installing PowerShell šŸ‹\t\n" sudo apt-get -yq update sudo apt-get -yq install powershell printf "\n\tšŸ‹ Installed PWSH šŸ‹\t\n" pwsh -v printf "\n\tšŸ‹ Installing PowerShell modules šŸ‹\t\n" modules=("MarkdownPS" "Pester" "PSScriptAnalyzer") for mod in "${modules[@]}"; do printf "\n\tšŸ‹ Installing %s šŸ‹\t\n" "${mod}" pwsh -nol -nop -c "Install-Module -Name ${mod} -Scope AllUsers -SkipPublisherCheck -Force" done printf "\n\tšŸ‹ Cleaning image šŸ‹\t\n" apt-get clean rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories' printf "\n\tšŸ‹ Cleaned up image šŸ‹\t\n"