aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-06-06 19:38:02 +0300
committerGitHub <noreply@github.com>2022-06-06 19:38:02 +0300
commit07f2b34faba9785646647c27a8445912df57fdc6 (patch)
treeb46ec6dde4ce7b515c4a5cbe6fb280762697938c
parenta87dca40b5763cfcdb0881b0b589a05766ce7e04 (diff)
fix miscellaneous bugs (#41)
* add recursive linking * temp change * fix xdebug * fix rbenv xdebug * fix hugo * remove suffix * php: fix config * fix anaconda and oryx * fix xdebug * fixes php * bug fix: composer * anaconda * nit * fix shellchecker * shellchecker
-rwxr-xr-xsrc/oryx/install.sh2
-rw-r--r--src/php/devcontainer-feature.json2
-rw-r--r--src/php/install.sh51
-rwxr-xr-xsrc/python/install.sh4
-rw-r--r--src/ruby/install.sh54
-rw-r--r--v1/feature-scripts.env8
6 files changed, 67 insertions, 54 deletions
diff --git a/src/oryx/install.sh b/src/oryx/install.sh
index bdbe395..ec614c1 100755
--- a/src/oryx/install.sh
+++ b/src/oryx/install.sh
@@ -10,7 +10,7 @@
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
-set -eu
+set -eux
if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
diff --git a/src/php/devcontainer-feature.json b/src/php/devcontainer-feature.json
index 2832eb1..bd7303e 100644
--- a/src/php/devcontainer-feature.json
+++ b/src/php/devcontainer-feature.json
@@ -30,7 +30,7 @@
],
"containerEnv": {
"PHP_PATH": "/usr/local/php/current",
- "PATH": "${PHP_PATH}:${PHP_PATH}/bin:${PATH}"
+ "PATH": "${PHP_PATH}/bin:${PATH}"
},
"install": {
"app": "",
diff --git a/src/php/install.sh b/src/php/install.sh
index 7da6cb8..6956292 100644
--- a/src/php/install.sh
+++ b/src/php/install.sh
@@ -87,13 +87,13 @@ find_version_from_git_tags() {
# Install PHP Composer
addcomposer() {
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+ "${PHP_INSTALL_DIR}/bin/php" -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
HASH="$(wget -q -O - https://composer.github.io/installer.sig)"
- php -r "if (hash_file('sha384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php
- php -r "unlink('composer-setup.php');"
+ "${PHP_INSTALL_DIR}/bin/php" -r "if (hash_file('sha384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
+ "${PHP_INSTALL_DIR}/bin/php" composer-setup.php
+ "${PHP_INSTALL_DIR}/bin/php" -r "unlink('composer-setup.php');"
- mv composer.phar "${PHP_INSTALL_DIR}/composer"
+ mv composer.phar "${PHP_INSTALL_DIR}/bin/composer"
}
# Install PHP if it's missing
@@ -125,11 +125,11 @@ fi
PHP_URL="https://www.php.net/distributions/php-${VERSION}.tar.gz"
PHP_INI_DIR="${PHP_INSTALL_DIR}/ini"
-CONF_DIR="$PHP_INI_DIR/conf.d"
-mkdir -p $CONF_DIR;
+CONF_DIR="${PHP_INI_DIR}/conf.d"
+mkdir -p "${CONF_DIR}";
PHP_EXT_DIR="${PHP_INSTALL_DIR}/extensions"
-mkdir -p $PHP_EXT_DIR
+mkdir -p "${PHP_EXT_DIR}"
PHP_SRC_DIR="/usr/src/php"
mkdir -p $PHP_SRC_DIR
@@ -142,7 +142,7 @@ cd $PHP_SRC_DIR;
# 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 <<< "${VERSION}"
PHP_MAJOR_VERSION=${versions[0]}
PHP_MINOR_VERSION=${versions[1]}
@@ -162,33 +162,32 @@ make clean
cp -v $PHP_SRC_DIR/php.ini-* "$PHP_INI_DIR/";
cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
+# Install xdebug
+"${PHP_INSTALL_DIR}/bin/pecl" install xdebug
+XDEBUG_INI="${CONF_DIR}/xdebug.ini"
+
+echo "zend_extension=${PHP_EXT_DIR}/xdebug.so" > "${XDEBUG_INI}"
+echo "xdebug.mode = debug" >> "${XDEBUG_INI}"
+echo "xdebug.start_with_request = yes" >> "${XDEBUG_INI}"
+echo "xdebug.client_port = 9003" >> "${XDEBUG_INI}"
+
+# Install PHP Composer if needed
+if [[ "${INSTALL_COMPOSER}" = "true" ]] || [[ $(composer --version) = "" ]]; then
+ addcomposer
+fi
+
CURRENT_DIR="${PHP_DIR}/current"
if [[ ! -d "${CURRENT_DIR}" ]]; then
- ln -s "${PHP_INSTALL_DIR}" ${CURRENT_DIR}
+ ln -s -r "${PHP_INSTALL_DIR}" ${CURRENT_DIR}
fi
if [ "${OVERRIDE_DEFAULT_VERSION}" = "true" ]; then
if [[ $(ls -l ${CURRENT_DIR}) != *"-> ${PHP_INSTALL_DIR}"* ]] ; then
rm "${CURRENT_DIR}"
- ln -s "${PHP_INSTALL_DIR}" ${CURRENT_DIR}
+ ln -s -r "${PHP_INSTALL_DIR}" ${CURRENT_DIR}
fi
fi
-export PATH="${PATH}:${CURRENT_DIR}/bin"
-
-# Install xdebug
-pecl -d php_suffix=${VERSION} install xdebug
-XDEBUG_INI="$CONF_DIR/xdebug.ini"
-echo "zend_extension=$(find $PHP_EXT_DIR -name xdebug.so)" > XDEBUG_INI
-echo "xdebug.mode = debug" >> XDEBUG_INI
-echo "xdebug.start_with_request = yes" >> XDEBUG_INI
-echo "xdebug.client_port = 9003" >> XDEBUG_INI
-
-# Install PHP Composer if needed
-if [[ "${INSTALL_COMPOSER}" = "true" ]] && [[ $(composer --version) = "" ]]; then
- addcomposer
-fi
-
rm -rf ${PHP_SRC_DIR}
updaterc "if [[ \"\${PATH}\" != *\"${CURRENT_DIR}\"* ]]; then export PATH=${CURRENT_DIR}/bin:\${PATH}; fi"
diff --git a/src/python/install.sh b/src/python/install.sh
index ed273c0..a3516da 100755
--- a/src/python/install.sh
+++ b/src/python/install.sh
@@ -211,13 +211,13 @@ check_packages() {
add_symlink() {
if [[ ! -d "${CURRENT_PATH}" ]]; then
- ln -s "${INSTALL_PATH}" "${CURRENT_PATH}"
+ ln -s -r "${INSTALL_PATH}" "${CURRENT_PATH}"
fi
if [ "${OVERRIDE_DEFAULT_VERSION}" = "true" ]; then
if [[ $(ls -l ${CURRENT_PATH}) != *"-> ${INSTALL_PATH}"* ]] ; then
rm "${CURRENT_PATH}"
- ln -s "${INSTALL_PATH}" "${CURRENT_PATH}"
+ ln -s -r "${INSTALL_PATH}" "${CURRENT_PATH}"
fi
fi
}
diff --git a/src/ruby/install.sh b/src/ruby/install.sh
index 2e9b37a..f4c7b10 100644
--- a/src/ruby/install.sh
+++ b/src/ruby/install.sh
@@ -191,7 +191,7 @@ fi
find_version_from_git_tags RUBY_VERSION "https://github.com/ruby/ruby" "tags/v" "_"
# Just install Ruby if RVM already installed
-if [ rvm --version != ""]; then
+if [ $(rvm --version) != "" ]; then
echo "Ruby Version Manager already exists."
if [ "${RUBY_VERSION}" != "none" ]; then
echo "Installing specified Ruby version."
@@ -241,29 +241,41 @@ fi
updaterc "if ! grep rvm_silence_path_mismatch_check_flag \$HOME/.rvmrc > /dev/null 2>&1; then echo 'rvm_silence_path_mismatch_check_flag=1' >> \$HOME/.rvmrc; fi\nsource /usr/local/rvm/scripts/rvm > /dev/null 2>&1"
# Install rbenv/ruby-build for good measure
-if [ ${SKIP_RBENV_RBUILD} != "true"] ; then
- git clone --depth=1 \
- -c core.eol=lf \
- -c core.autocrlf=false \
- -c fsck.zeroPaddedFilemode=ignore \
- -c fetch.fsck.zeroPaddedFilemode=ignore \
- -c receive.fsck.zeroPaddedFilemode=ignore \
- https://github.com/rbenv/rbenv.git /usr/local/share/rbenv
- ln -s /usr/local/share/rbenv/bin/rbenv /usr/local/bin
- updaterc 'eval "$(rbenv init -)"'
- git clone --depth=1 \
- -c core.eol=lf \
- -c core.autocrlf=false \
- -c fsck.zeroPaddedFilemode=ignore \
- -c fetch.fsck.zeroPaddedFilemode=ignore \
- -c receive.fsck.zeroPaddedFilemode=ignore \
- https://github.com/rbenv/ruby-build.git /usr/local/share/ruby-build
- mkdir -p /root/.rbenv/plugins
- ln -s /usr/local/share/ruby-build /root/.rbenv/plugins/ruby-build
+if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then
+
+ if [[ ! -d "/usr/local/share/rbenv" ]]; then
+ git clone --depth=1 \
+ -c core.eol=lf \
+ -c core.autocrlf=false \
+ -c fsck.zeroPaddedFilemode=ignore \
+ -c fetch.fsck.zeroPaddedFilemode=ignore \
+ -c receive.fsck.zeroPaddedFilemode=ignore \
+ https://github.com/rbenv/rbenv.git /usr/local/share/rbenv
+
+ ln -s /usr/local/share/rbenv/bin/rbenv /usr/local/bin
+ updaterc 'eval "$(rbenv init -)"'
+ fi
+
+ if [[ ! -d "/usr/local/share/ruby-build" ]]; then
+ git clone --depth=1 \
+ -c core.eol=lf \
+ -c core.autocrlf=false \
+ -c fsck.zeroPaddedFilemode=ignore \
+ -c fetch.fsck.zeroPaddedFilemode=ignore \
+ -c receive.fsck.zeroPaddedFilemode=ignore \
+ https://github.com/rbenv/ruby-build.git /usr/local/share/ruby-build
+ mkdir -p /root/.rbenv/plugins
+
+ ln -s /usr/local/share/ruby-build /root/.rbenv/plugins/ruby-build
+ fi
+
if [ "${USERNAME}" != "root" ]; then
mkdir -p /home/${USERNAME}/.rbenv/plugins
chown -R ${USERNAME} /home/${USERNAME}/.rbenv
- ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build
+
+ if [[ ! -d "/home/${USERNAME}/.rbenv/plugins/ruby-build" ]]; then
+ ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build
+ fi
fi
fi
diff --git a/v1/feature-scripts.env b/v1/feature-scripts.env
index 3335005..7503ce5 100644
--- a/v1/feature-scripts.env
+++ b/v1/feature-scripts.env
@@ -1,4 +1,4 @@
-_BUILD_ARG_COMMON="./common/install.sh ${_BUILD_ARG_COMMON_INSTALLZSH} ${_BUILD_ARG_COMMON_USERNAME} ${_BUILD_ARG_COMMON_UID} ${_BUILD_ARG_COMMON_GID} ${_BUILD_ARG_COMMON_UPGRADEPACKAGES} ${_BUILD_ARG_COMMON_INSTALLOHMYZSH} ${_BUILD_ARG_COMMON_NONFREEPACKAGES}"
+_BUILD_ARG_COMMON="./common/install.sh ${_BUILD_ARG_COMMON_INSTALLZSH:-true} ${_BUILD_ARG_COMMON_USERNAME:-automatic} ${_BUILD_ARG_COMMON_UID:-automatic} ${_BUILD_ARG_COMMON_GID:-automatic} ${_BUILD_ARG_COMMON_UPGRADEPACKAGES:-true} ${_BUILD_ARG_COMMON_INSTALLOHMYZSH:-true} ${_BUILD_ARG_COMMON_NONFREEPACKAGES:-false}"
_BUILD_ARG_GIT="./git/install.sh ${_BUILD_ARG_GIT_VERSION:-latest} ${_BUILD_ARG_GIT_PPA:-true}"
_BUILD_ARG_GIT_LFS="./git-lfs/install.sh ${_BUILD_ARG_GIT_LFS_VERSION:-latest}"
_BUILD_ARG_DOCKER_IN_DOCKER="./docker-in-docker/install.sh true automatic ${_BUILD_ARG_DOCKER_IN_DOCKER_MOBY:-true} ${_BUILD_ARG_DOCKER_IN_DOCKER_VERSION:-latest} ${_BUILD_ARG_DOCKER_IN_DOCKER_DOCKERDASHCOMPOSEVERSION:-v1}"
@@ -20,6 +20,8 @@ _BUILD_ARG_RUST="./rust/install.sh /usr
_BUILD_ARG_POWERSHELL="./powershell/install.sh ${_BUILD_ARG_POWERSHELL_VERSION:-latest}"
_BUILD_ARG_DESKTOP_LITE="./desktop-lite/install.sh automatic ${_BUILD_ARG_DESKTOP_LITE_PASSWORD:-vscode} true ${_BUILD_ARG_DESKTOP_LITE_VNCPORT:-5901} ${_BUILD_ARG_DESKTOP_LITE_WEBPORT:-6080}"
_BUILD_ARG_DOTNET="./dotnet/install.sh ${_BUILD_ARG_DOTNET_VERSION:-latest} ${_BUILD_ARG_DOTNET_RUNTIMEONLY:-false} automatic true /usr/local/dotnet dotnet ${_BUILD_ARG_DOTNET_OVERRIDEDEFAULTVERSION:-true} ${_BUILD_ARG_DOTNET_INSTALLUSINGAPT:-true}"
-_BUILD_ARG_JUPYTERLAB="./jupyterlab/install.sh ${_BUILD_ARG_JUPYTERLAB_VERSION:-latest}" automatic ${_BUILD_ARG_JUPYTERLAB_PYTHONBINARY:-python}" true
+_BUILD_ARG_JUPYTERLAB="./jupyterlab/install.sh ${_BUILD_ARG_JUPYTERLAB_VERSION:-latest} automatic ${_BUILD_ARG_JUPYTERLAB_PYTHONBINARY:-python} true"
_BUILD_ARG_PHP="./php/install.sh ${_BUILD_ARG_PHP_VERSION:-latest} /usr/local/php ${_BUILD_ARG_PHP_INSTALLCOMPOSER:-true} automatic true ${_BUILD_ARG_PHP_OVERRIDEDEFAULTVERSION:-true}"
-_BUILD_ARG_ORYX="./oryx/install.sh" \ No newline at end of file
+_BUILD_ARG_ORYX="./oryx/install.sh automatic true"
+_BUILD_ARG_HUGO="./hugo/install.sh ${_BUILD_ARG_HUGO_VERSION:-latest} automatic true"
+_BUILD_ARG_ANACONDA="./anaconda/install.sh ${_BUILD_ARG_ANACONDA_VERSION:-latest} automatic true" \ No newline at end of file