diff --git a/features/src/vip-cli/devcontainer-feature.json b/features/src/vip-cli/devcontainer-feature.json index 734d7701..27585705 100644 --- a/features/src/vip-cli/devcontainer-feature.json +++ b/features/src/vip-cli/devcontainer-feature.json @@ -1,7 +1,7 @@ { "id": "vip-cli", "name": "VIP-CLI", - "version": "1.4.4", + "version": "1.4.5", "description": "Installs VIP-CLI into the Dev Environment", "options": { "enabled": { diff --git a/features/src/vip-cli/install.sh b/features/src/vip-cli/install.sh index 49052a37..ef14f8c9 100755 --- a/features/src/vip-cli/install.sh +++ b/features/src/vip-cli/install.sh @@ -10,14 +10,11 @@ if [ "$(id -u || true)" -ne 0 ]; then fi : "${ENABLED:=}" -: "${VERSION:=latest}" +VIP_CLI_VERSION="${VERSION:-latest}" if [ "${ENABLED}" = "true" ]; then echo '(*) Installing VIP CLI...' - # /etc/os-release may overwrite VERSION - VIP_CLI_VERSION="${VERSION}" - if ! hash node >/dev/null 2>&1 || ! hash npm >/dev/null 2>&1; then # shellcheck source=/dev/null . /etc/os-release @@ -28,32 +25,37 @@ if [ "${ENABLED}" = "true" ]; then case "${ID_LIKE}" in "debian") export DEBIAN_FRONTEND=noninteractive - PACKAGES="" - - if ! hash curl >/dev/null 2>&1; then - PACKAGES="${PACKAGES} curl" - fi - - if ! hash update-ca-certificates >/dev/null 2>&1; then - PACKAGES="${PACKAGES} ca-certificates" - fi - if [ -n "${PACKAGES}" ]; then - apt-get update - # shellcheck disable=SC2086 - apt-get install -y --no-install-recommends ${PACKAGES} + if ! hash node >/dev/null 2>&1 || ! hash npm >/dev/null 2>&1 || ! hash npx >/dev/null 2>&1; then + PACKAGES="" + if ! hash curl >/dev/null 2>&1; then + PACKAGES="${PACKAGES} curl" + fi + + if ! hash update-ca-certificates >/dev/null 2>&1; then + PACKAGES="${PACKAGES} ca-certificates" + fi + + if [ -n "${PACKAGES}" ]; then + apt-get update + # shellcheck disable=SC2086 + apt-get install -y --no-install-recommends ${PACKAGES} + fi + + curl -fsSL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh + chmod +x nodesource_setup.sh + ./nodesource_setup.sh + apt-get install -y nodejs + + apt-get clean + rm -rf /var/lib/apt/lists/* fi - - curl -fsSL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh && chmod +x nodesource_setup.sh - ./nodesource_setup.sh - apt-get install -y nodejs - - apt-get clean - rm -rf /var/lib/apt/lists/* ;; "alpine") - apk add --no-cache nodejs npm + if ! hash node >/dev/null 2>&1 || ! hash npm >/dev/null 2>&1; then + apk add --no-cache nodejs npm + fi ;; *)