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
This commit is contained in:
Samruddhi Khandale 2022-06-06 09:38:02 -07:00 committed by GitHub
parent a87dca40b5
commit 07f2b34fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 54 deletions

View file

@ -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.'

View file

@ -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": "",

View file

@ -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"

View file

@ -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
}

View file

@ -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,7 +241,9 @@ 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
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 \
@ -249,8 +251,12 @@ if [ ${SKIP_RBENV_RBUILD} != "true"] ; then
-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 \
@ -259,12 +265,18 @@ if [ ${SKIP_RBENV_RBUILD} != "true"] ; then
-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
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
# Clean up

View file

@ -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"
_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"