From c8383b60e06c5f46bbd8254781842d4e077034fe Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Wed, 23 Nov 2022 22:21:26 +0000 Subject: [PATCH 1/2] Features: Set USERNAME to _REMOTE_USER if available --- src/anaconda/devcontainer-feature.json | 2 +- src/anaconda/install.sh | 2 +- src/common-utils/devcontainer-feature.json | 2 +- src/common-utils/install.sh | 2 +- src/desktop-lite/devcontainer-feature.json | 2 +- src/desktop-lite/install.sh | 2 +- src/docker-from-docker/devcontainer-feature.json | 2 +- src/docker-from-docker/install.sh | 2 +- src/docker-in-docker/devcontainer-feature.json | 2 +- src/docker-in-docker/install.sh | 2 +- src/dotnet/devcontainer-feature.json | 2 +- src/dotnet/install.sh | 2 +- src/go/devcontainer-feature.json | 2 +- src/go/install.sh | 2 +- src/hugo/devcontainer-feature.json | 2 +- src/hugo/install.sh | 2 +- src/java/devcontainer-feature.json | 2 +- src/java/install.sh | 2 +- src/kubectl-helm-minikube/devcontainer-feature.json | 2 +- src/kubectl-helm-minikube/install.sh | 2 +- src/node/devcontainer-feature.json | 2 +- src/node/install.sh | 2 +- src/oryx/devcontainer-feature.json | 2 +- src/oryx/install.sh | 2 +- src/php/devcontainer-feature.json | 2 +- src/php/install.sh | 2 +- src/python/devcontainer-feature.json | 2 +- src/python/install.sh | 2 +- src/ruby/devcontainer-feature.json | 2 +- src/ruby/install.sh | 2 +- src/rust/devcontainer-feature.json | 2 +- src/rust/install.sh | 2 +- src/sshd/devcontainer-feature.json | 2 +- src/sshd/install.sh | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/anaconda/devcontainer-feature.json b/src/anaconda/devcontainer-feature.json index 7308699cf..cdf1fbf7e 100644 --- a/src/anaconda/devcontainer-feature.json +++ b/src/anaconda/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "anaconda", - "version": "1.0.9", + "version": "1.0.10", "name": "Anaconda", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/anaconda", "options": { diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh index 47f3462d5..07661d43e 100755 --- a/src/anaconda/install.sh +++ b/src/anaconda/install.sh @@ -9,7 +9,7 @@ VERSION=${VERSION:-"latest"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"} diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json index 9a135d516..74b85081b 100644 --- a/src/common-utils/devcontainer-feature.json +++ b/src/common-utils/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "common-utils", - "version": "1.1.4", + "version": "1.1.5", "name": "Common Debian Utilities", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils", "description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.", diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh index 8ac0a7c62..ed29adeb0 100755 --- a/src/common-utils/install.sh +++ b/src/common-utils/install.sh @@ -15,7 +15,7 @@ rm -rf /var/lib/apt/lists/* INSTALL_ZSH=${INSTALLZSH:-"true"} INSTALL_OH_MY_ZSH=${INSTALLOHMYZSH:-"true"} UPGRADE_PACKAGES=${UPGRADEPACKAGES:-"true"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" USER_UID=${UID:-"automatic"} USER_GID=${GID:-"automatic"} ADD_NON_FREE_PACKAGES=${NONFREEPACKAGES:-"false"} diff --git a/src/desktop-lite/devcontainer-feature.json b/src/desktop-lite/devcontainer-feature.json index 9420dc3dd..e0333867f 100644 --- a/src/desktop-lite/devcontainer-feature.json +++ b/src/desktop-lite/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "desktop-lite", - "version": "1.0.5", + "version": "1.0.6", "name": "Light-weight Desktop", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite", "description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.", diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index dc8ee3932..befab4043 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -13,7 +13,7 @@ NOVNC_PORT="${WEBPORT:-6080}" VNC_PORT="${VNCPORT:-5901}" INSTALL_NOVNC=${INSTALL_NOVNC:-"true"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" WEBSOCKETIFY_VERSION=0.10.0 diff --git a/src/docker-from-docker/devcontainer-feature.json b/src/docker-from-docker/devcontainer-feature.json index dc7208973..2ebdd3833 100644 --- a/src/docker-from-docker/devcontainer-feature.json +++ b/src/docker-from-docker/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "docker-from-docker", - "version": "1.0.6", + "version": "1.0.7", "name": "Docker (Docker-from-Docker)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-from-docker", "descripton": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.", diff --git a/src/docker-from-docker/install.sh b/src/docker-from-docker/install.sh index d128ab9c9..ede83f0a7 100755 --- a/src/docker-from-docker/install.sh +++ b/src/docker-from-docker/install.sh @@ -14,7 +14,7 @@ DOCKER_DASH_COMPOSE_VERSION=${DOCKERDASHCOMPOSEVERSION:-"v1"} # v1 or v2 ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"} SOURCE_SOCKET=${SOURCE_SOCKET:-"/var/run/docker-host.sock"} TARGET_SOCKET=${TARGET_SOCKET:-"/var/run/docker.sock"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" diff --git a/src/docker-in-docker/devcontainer-feature.json b/src/docker-in-docker/devcontainer-feature.json index 95a6a2c5a..95d6841fd 100644 --- a/src/docker-in-docker/devcontainer-feature.json +++ b/src/docker-in-docker/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "docker-in-docker", - "version": "1.0.8", + "version": "1.0.9", "name": "Docker (Docker-in-Docker)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker", "description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.", diff --git a/src/docker-in-docker/install.sh b/src/docker-in-docker/install.sh index fe4692f3e..f39685f02 100755 --- a/src/docker-in-docker/install.sh +++ b/src/docker-in-docker/install.sh @@ -15,7 +15,7 @@ AZURE_DNS_AUTO_DETECTION=${AZUREDNSAUTODETECTION:-"true"} DOCKER_DEFAULT_ADDRESS_POOL=${DOCKERDEFAULTADDRESSPOOL} ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy" diff --git a/src/dotnet/devcontainer-feature.json b/src/dotnet/devcontainer-feature.json index 42eb1c287..e8bb9f16c 100644 --- a/src/dotnet/devcontainer-feature.json +++ b/src/dotnet/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "dotnet", - "version": "1.1.0", + "version": "1.1.1", "name": "Dotnet CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet", "description": "Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.", diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh index 78cd691df..37ffb088f 100755 --- a/src/dotnet/install.sh +++ b/src/dotnet/install.sh @@ -15,7 +15,7 @@ INSTALL_USING_APT=${INSTALLUSINGAPT:-"true"} DOTNET_LATEST="7" DOTNET_LTS="6" -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} TARGET_DOTNET_ROOT=${TARGET_DOTNET_ROOT:-"/usr/local/dotnet"} ACCESS_GROUP=${ACCESS_GROUP:-"dotnet"} diff --git a/src/go/devcontainer-feature.json b/src/go/devcontainer-feature.json index b2aa30bc7..f63d93ec1 100644 --- a/src/go/devcontainer-feature.json +++ b/src/go/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "go", - "version": "1.1.1", + "version": "1.1.2", "name": "Go", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/go", "description": "Installs Go and common Go utilities. Auto-detects latest version and installs needed dependencies.", diff --git a/src/go/install.sh b/src/go/install.sh index 844411fcd..068a95dc6 100755 --- a/src/go/install.sh +++ b/src/go/install.sh @@ -12,7 +12,7 @@ GOLANGCILINT_VERSION=${GOLANGCILINTVERSION:-"latest"} TARGET_GOROOT=${TARGET_GOROOT:-"/usr/local/go"} TARGET_GOPATH=${TARGET_GOPATH:-"/go"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" INSTALL_GO_TOOLS=${INSTALL_GO_TOOLS:-"true"} # https://www.google.com/linuxrepositories/ diff --git a/src/hugo/devcontainer-feature.json b/src/hugo/devcontainer-feature.json index 37a805dce..ffc1a3bdb 100644 --- a/src/hugo/devcontainer-feature.json +++ b/src/hugo/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "hugo", - "version": "1.1.0", + "version": "1.1.1", "name": "Hugo", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/hugo", "options": { diff --git a/src/hugo/install.sh b/src/hugo/install.sh index c5cb628f1..7b6968494 100755 --- a/src/hugo/install.sh +++ b/src/hugo/install.sh @@ -9,7 +9,7 @@ VERSION=${VERSION:-"latest"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} HUGO_DIR=${HUGO_DIR:-"/usr/local/hugo"} diff --git a/src/java/devcontainer-feature.json b/src/java/devcontainer-feature.json index c400fb6c7..4c7df039b 100644 --- a/src/java/devcontainer-feature.json +++ b/src/java/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "java", - "version": "1.1.0", + "version": "1.1.1", "name": "Java (via SDKMAN!)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/java", "description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.", diff --git a/src/java/install.sh b/src/java/install.sh index 592847800..208f4d69a 100755 --- a/src/java/install.sh +++ b/src/java/install.sh @@ -17,7 +17,7 @@ MAVEN_VERSION=${MAVENVERSION:-"latest"} JDK_DISTRO=${JDKDISTRO} export SDKMAN_DIR=${SDKMAN_DIR:-"/usr/local/sdkman"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} # Comma-separated list of java versions to be installed diff --git a/src/kubectl-helm-minikube/devcontainer-feature.json b/src/kubectl-helm-minikube/devcontainer-feature.json index f8098b403..beea80a2e 100644 --- a/src/kubectl-helm-minikube/devcontainer-feature.json +++ b/src/kubectl-helm-minikube/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "kubectl-helm-minikube", - "version": "1.1.0", + "version": "1.1.1", "name": "Kubectl, Helm, and Minikube", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube", "description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.", diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh index c961e5652..3ab65356f 100755 --- a/src/kubectl-helm-minikube/install.sh +++ b/src/kubectl-helm-minikube/install.sh @@ -19,7 +19,7 @@ MINIKUBE_VERSION="${MINIKUBE:-"none"}" # latest is also valid KUBECTL_SHA256="${KUBECTL_SHA256:-"automatic"}" HELM_SHA256="${HELM_SHA256:-"automatic"}" MINIKUBE_SHA256="${MINIKUBE_SHA256:-"automatic"}" -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" HELM_GPG_KEYS_URI="https://raw.githubusercontent.com/helm/helm/main/KEYS" GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80 diff --git a/src/node/devcontainer-feature.json b/src/node/devcontainer-feature.json index 49d2160fa..3abfb0400 100644 --- a/src/node/devcontainer-feature.json +++ b/src/node/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "node", - "version": "1.1.2", + "version": "1.1.3", "name": "Node.js (via nvm) and yarn", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/node", "description": "Installs Node.js, nvm, yarn, and needed dependencies.", diff --git a/src/node/install.sh b/src/node/install.sh index 2f2e7aa38..978b83e24 100755 --- a/src/node/install.sh +++ b/src/node/install.sh @@ -16,7 +16,7 @@ INSTALL_TOOLS_FOR_NODE_GYP="${NODEGYPDEPENDENCIES:-true}" # alongside NODE_VERSION, but not set as default. ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} set -e diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json index 5c643445b..9a6bd25c2 100644 --- a/src/oryx/devcontainer-feature.json +++ b/src/oryx/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "oryx", - "version": "1.0.12", + "version": "1.0.13", "name": "Oryx", "description": "Installs the oryx CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/oryx", diff --git a/src/oryx/install.sh b/src/oryx/install.sh index aa4af2c8c..3ff8da969 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -5,7 +5,7 @@ #------------------------------------------------------------------------------------------------------------- -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" diff --git a/src/php/devcontainer-feature.json b/src/php/devcontainer-feature.json index 181851e32..bad987872 100644 --- a/src/php/devcontainer-feature.json +++ b/src/php/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "php", - "version": "1.0.8", + "version": "1.0.9", "name": "PHP", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/php", "options": { diff --git a/src/php/install.sh b/src/php/install.sh index 70b63da69..f922a699f 100755 --- a/src/php/install.sh +++ b/src/php/install.sh @@ -16,7 +16,7 @@ INSTALL_COMPOSER=${INSTALLCOMPOSER:-"true"} OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"} export PHP_DIR=${PHP_DIR:-"/usr/local/php"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} # Comma-separated list of php versions to be installed diff --git a/src/python/devcontainer-feature.json b/src/python/devcontainer-feature.json index b96511b9f..ca474ab4c 100644 --- a/src/python/devcontainer-feature.json +++ b/src/python/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "python", - "version": "1.0.15", + "version": "1.0.16", "name": "Python", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/python", "description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.", diff --git a/src/python/install.sh b/src/python/install.sh index d823cc99e..2c4792af7 100755 --- a/src/python/install.sh +++ b/src/python/install.sh @@ -15,7 +15,7 @@ OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"} export PIPX_HOME=${PIPX_HOME:-"/usr/local/py-utils"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} USE_ORYX_IF_AVAILABLE=${USEORYXIFAVAILABLE:-"true"} diff --git a/src/ruby/devcontainer-feature.json b/src/ruby/devcontainer-feature.json index c76d85dbc..e11c1727a 100644 --- a/src/ruby/devcontainer-feature.json +++ b/src/ruby/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "ruby", - "version": "1.0.6", + "version": "1.0.7", "name": "Ruby (via rvm)", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby", "description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.", diff --git a/src/ruby/install.sh b/src/ruby/install.sh index 22285225b..bf2cbbe75 100755 --- a/src/ruby/install.sh +++ b/src/ruby/install.sh @@ -9,7 +9,7 @@ RUBY_VERSION=${VERSION:-"latest"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} INSTALL_RUBY_TOOLS=${INSTALL_RUBY_TOOLS:-"true"} diff --git a/src/rust/devcontainer-feature.json b/src/rust/devcontainer-feature.json index 2dca581fc..8a7f5b432 100644 --- a/src/rust/devcontainer-feature.json +++ b/src/rust/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "rust", - "version": "1.0.8", + "version": "1.0.9", "name": "Rust", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/rust", "description": "Installs Rust, common Rust utilities, and their required dependencies", diff --git a/src/rust/install.sh b/src/rust/install.sh index e7cfb7151..71d337fdb 100755 --- a/src/rust/install.sh +++ b/src/rust/install.sh @@ -12,7 +12,7 @@ RUSTUP_PROFILE=${PROFILE:-"minimal"} export CARGO_HOME=${CARGO_HOME:-"/usr/local/cargo"} export RUSTUP_HOME=${RUSTUP_HOME:-"/usr/local/rustup"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} UPDATE_RUST=${UPDATE_RUST:-"false"} diff --git a/src/sshd/devcontainer-feature.json b/src/sshd/devcontainer-feature.json index 6433f3f1f..b8b7badaf 100644 --- a/src/sshd/devcontainer-feature.json +++ b/src/sshd/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "sshd", - "version": "1.0.5", + "version": "1.0.6", "name": "SSH server", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/sshd", "description": "Adds a SSH server into a container so that you can use an external terminal, sftp, or SSHFS to interact with it.", diff --git a/src/sshd/install.sh b/src/sshd/install.sh index a93b927f5..1fbaa8dde 100755 --- a/src/sshd/install.sh +++ b/src/sshd/install.sh @@ -10,7 +10,7 @@ # Note: You can change your user's password with "sudo passwd $(whoami)" (or just "passwd" if running as root). SSHD_PORT=${SSHD_PORT:-"2222"} -USERNAME=${USERNAME:-"automatic"} +USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" START_SSHD=${START_SSHD:-"false"} NEW_PASSWORD=${NEW_PASSWORD:-"skip"} FIX_ENVIRONMENT=${FIX_ENVIRONMENT:-"true"} From 627fc411904a0a68d7e3d9cc6a7af79609d57720 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Mon, 28 Nov 2022 19:11:30 +0000 Subject: [PATCH 2/2] fix php test --- src/php/install.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/php/install.sh b/src/php/install.sh index f922a699f..8fb49a3c4 100755 --- a/src/php/install.sh +++ b/src/php/install.sh @@ -11,7 +11,7 @@ set -eux # Clean up rm -rf /var/lib/apt/lists/* -VERSION=${VERSION:-"latest"} +PHP_VERSION=${VERSION:-"latest"} INSTALL_COMPOSER=${INSTALLCOMPOSER:-"true"} OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"} @@ -20,7 +20,7 @@ USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC=${UPDATE_RC:-"true"} # Comma-separated list of php versions to be installed -# alongside VERSION, but not set as default. +# alongside PHP_VERSION, but not set as default. ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""} export DEBIAN_FRONTEND=noninteractive @@ -92,7 +92,7 @@ find_version_from_git_tags() { local last_part="${escaped_separator}[0-9]+" local regex="\\K[0-9]+${escaped_separator}[0-9]+${last_part}$" local version_list="$(git ls-remote --tags ${repository} | grep -oP "${regex}" | tr -d ' ' | tr "${separator}" "." | sort -rV)" - VERSION="$(echo "${version_list}" | head -n 1)" + PHP_VERSION="$(echo "${version_list}" | head -n 1)" } # Install PHP Composer @@ -112,8 +112,15 @@ addcomposer() { # Persistent / runtime dependencies RUNTIME_DEPS="wget ca-certificates git build-essential xz-utils" +. /etc/os-release +LIBARGON_DEP="libargon2-dev" + +if [[ "bionic" = *"${VERSION_CODENAME}"* ]]; then + LIBARGON_DEP="libargon2-0-dev" +fi + # PHP dependencies -PHP_DEPS="libssl-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev libxml2-dev zlib1g-dev libsodium-dev libargon2-dev libonig-dev" +PHP_DEPS="libssl-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev libxml2-dev zlib1g-dev libsodium-dev ${LIBARGON_DEP} libonig-dev" # Dependencies required for running "phpize" PHPIZE_DEPS="autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c" @@ -122,16 +129,16 @@ PHPIZE_DEPS="autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c" check_packages $RUNTIME_DEPS $PHP_DEPS $PHPIZE_DEPS install_php() { - VERSION="$1" + PHP_VERSION="$1" # Fetch latest version of PHP if needed - if [ "${VERSION}" = "latest" ] || [ "${VERSION}" = "lts" ]; then + if [ "${PHP_VERSION}" = "latest" ] || [ "${PHP_VERSION}" = "lts" ]; then find_version_from_git_tags fi - PHP_INSTALL_DIR="${PHP_DIR}/${VERSION}" + PHP_INSTALL_DIR="${PHP_DIR}/${PHP_VERSION}" if [ -d "${PHP_INSTALL_DIR}" ]; then - echo "(!) PHP version ${VERSION} already exists." + echo "(!) PHP version ${PHP_VERSION} already exists." exit 1 fi @@ -140,7 +147,7 @@ install_php() { fi usermod -a -G php "${USERNAME}" - PHP_URL="https://www.php.net/distributions/php-${VERSION}.tar.gz" + PHP_URL="https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz" PHP_INI_DIR="${PHP_INSTALL_DIR}/ini" CONF_DIR="${PHP_INI_DIR}/conf.d" @@ -160,7 +167,7 @@ install_php() { # PHP 7.4+, the pecl/pear installers are officially deprecated and are removed in PHP 8+ # Thus, requiring an explicit "--with-pear" IFS="." - read -a versions <<< "${VERSION}" + read -a versions <<< "${PHP_VERSION}" PHP_MAJOR_VERSION=${versions[0]} PHP_MINOR_VERSION=${versions[1]} @@ -210,7 +217,7 @@ install_php() { updaterc "if [[ \"\${PATH}\" != *\"${CURRENT_DIR}\"* ]]; then export PATH=\"${CURRENT_DIR}/bin:\${PATH}\"; fi" } -install_php "${VERSION}" +install_php "${PHP_VERSION}" # Additional php versions to be installed but not be set as default. if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then