diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-06-06 19:38:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-06 19:38:02 +0300 |
commit | 07f2b34faba9785646647c27a8445912df57fdc6 (patch) | |
tree | b46ec6dde4ce7b515c4a5cbe6fb280762697938c /src | |
parent | a87dca40b5763cfcdb0881b0b589a05766ce7e04 (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
Diffstat (limited to 'src')
-rwxr-xr-x | src/oryx/install.sh | 2 | ||||
-rw-r--r-- | src/php/devcontainer-feature.json | 2 | ||||
-rw-r--r-- | src/php/install.sh | 51 | ||||
-rwxr-xr-x | src/python/install.sh | 4 | ||||
-rw-r--r-- | src/ruby/install.sh | 54 |
5 files changed, 62 insertions, 51 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 |