diff options
Diffstat (limited to 'src/powershell')
-rw-r--r-- | src/powershell/devcontainer-feature.json | 11 | ||||
-rwxr-xr-x | src/powershell/install.sh | 12 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/powershell/devcontainer-feature.json b/src/powershell/devcontainer-feature.json index ef967a6..dce0575 100644 --- a/src/powershell/devcontainer-feature.json +++ b/src/powershell/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "powershell", - "version": "1.0.6", + "version": "1.1.0", "name": "PowerShell", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/powershell", "description": "Installs PowerShell along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.", @@ -14,8 +14,13 @@ ], "default": "latest", "description": "Select or enter a version of PowerShell." - } - }, + }, + "modules": { + "type": "string", + "default": "", + "description": "Optional comma separated list of PowerShell modules to install." + } + }, "installsAfter": [ "ghcr.io/devcontainers/features/common-utils" ] diff --git a/src/powershell/install.sh b/src/powershell/install.sh index 3f19f47..b220c3a 100755 --- a/src/powershell/install.sh +++ b/src/powershell/install.sh @@ -13,6 +13,7 @@ set -e rm -rf /var/lib/apt/lists/* POWERSHELL_VERSION=${VERSION:-"latest"} +POWERSHELL_MODULES="${MODULES}" MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" POWERSHELL_ARCHIVE_ARCHITECTURES="amd64" @@ -149,6 +150,17 @@ if [ "${use_github}" = "true" ]; then install_using_github fi +# If PowerShell modules are requested, loop through and install +if [ ${#POWERSHELL_MODULES[@]} -gt 0 ]; then + echo "Installing PowerShell Modules: ${POWERSHELL_MODULES}" + modules=(`echo ${POWERSHELL_MODULES} | tr ',' ' '`) + for i in "${modules[@]}" + do + echo "Installing ${i}" + pwsh -Command "Install-Module -Name ${i} -AllowClobber -Force -Scope AllUsers" || continue + done +fi + # Clean up rm -rf /var/lib/apt/lists/* |