-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master CreateInstance: 401 enable getIliasVersion function to handle …
…two major version digits
- Loading branch information
Showing
4 changed files
with
69 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
|
||
source "${SCRIPT_DIR}"/updates/update.sh | ||
|
||
doil_update_20231102() { | ||
echo "" | ||
echo "This update disables Xdebug on all instances. In order to continue using xdebug," | ||
echo "you must run 'doil apply <instance_name> enable-xdebug' for the desired instances after the update." | ||
echo "" | ||
|
||
update | ||
|
||
if [ $(docker ps -a --filter "name=_local" --filter "name=_global" --format "{{.Names}}" | wc -l) -gt 0 ] | ||
doil_status_send_message "Applying patch on existing instances" | ||
then | ||
for INSTANCE in $(docker ps -a --filter "name=_local" --filter "name=_global" --format "{{.Names}}") | ||
do | ||
NAME=${INSTANCE%_*} | ||
SUFFIX=${INSTANCE##*_} | ||
|
||
if [ -L /usr/local/share/doil/instances/"${NAME}" ] || [ -L /home/"${SUDO_USER}"/.doil/instances/"${NAME}" ] | ||
then | ||
if [ "${SUFFIX}" == "global" ] | ||
then | ||
INSTANCE_PATH=$(/usr/local/bin/doil path "${NAME}" -g -p) | ||
su -c "/usr/local/bin/doil apply ${NAME} disable-xdebug -g" "${SUDO_USER}" 2>&1 > /dev/null | ||
else | ||
INSTANCE_PATH=$(su -c "/usr/local/bin/doil path ${NAME} -p" "${SUDO_USER}") | ||
su -c "/usr/local/bin/doil apply ${NAME} disable-xdebug" "${SUDO_USER}" 2>&1 > /dev/null | ||
fi | ||
|
||
DOCKER_COMPOSE_PATH="${INSTANCE_PATH}/docker-compose.yml" | ||
LINE_NUMBER="$(grep -n 'source: ~/.config/composer/' "${DOCKER_COMPOSE_PATH}")" | ||
|
||
if [ ! -z "${LINE_NUMBER}" ] | ||
then | ||
LINE_NUMBER=${LINE_NUMBER%%:*} | ||
sed -i "$((LINE_NUMBER-1)),$((LINE_NUMBER+1))d" "${DOCKER_COMPOSE_PATH}" | ||
fi | ||
|
||
if [ ! -d "${INSTANCE_PATH}"/volumes/logs/xdebug ] | ||
then | ||
mkdir "${INSTANCE_PATH}"/volumes/logs/xdebug | ||
fi | ||
chmod 775 "${INSTANCE_PATH}"/volumes/logs/xdebug | ||
if [ "${SUFFIX}" == "global" ] | ||
then | ||
chown root:doil "${INSTANCE_PATH}"/volumes/logs/xdebug | ||
else | ||
chown "${SUDO_USER}":"${SUDO_USER}" "${INSTANCE_PATH}"/volumes/logs/xdebug | ||
fi | ||
|
||
if ! grep -q "source: ./volumes/logs/xdebug" "${DOCKER_COMPOSE_PATH}" | ||
then | ||
sed -i 's/volumes:/&\n - type: bind\n source: .\/volumes\/logs\/xdebug\n target: \/var\/log\/doil\/xdebug/' "${DOCKER_COMPOSE_PATH}" | ||
fi | ||
fi | ||
done | ||
|
||
su -c "/usr/local/bin/doil restart -a" "${SUDO_USER}" 2>&1 > /dev/null | ||
su -c "/usr/local/bin/doil restart -a -g" "${SUDO_USER}" 2>&1 > /dev/null | ||
|
||
doil_status_okay | ||
fi | ||
|
||
return $? | ||
} |