Skip to content

Commit

Permalink
fix: DEV-2107: Make setup-base.sh not create self-referencing link on…
Browse files Browse the repository at this point in the history
… repeated runs.
  • Loading branch information
rmuit committed Oct 12, 2024
1 parent 42cbaf7 commit 52ad61d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions scripts/setup-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ for SITE in `ls -d web/sites/*/`; do
mkdir -p $PERSISTENT_FILES_DIR/$SITE/private

if [ -n "$ENV_UNIX_GROUP_WEBSERVER" ]; then
sudo chown -R :$ENV_UNIX_GROUP_WEBSERVER $PERSISTENT_FILES_DIR/$SITE/
# When a custom group is set, ensure sub-directory and files are always
# webserver writable via the setgid bit. This makes the right group to be
# propagated down.
sudo chmod 2775 $PERSISTENT_FILES_DIR/$SITE/public
sudo chmod 2775 $PERSISTENT_FILES_DIR/$SITE/public/translations
sudo chmod 2775 $PERSISTENT_FILES_DIR/$SITE/private
if [[ $(id -u) -eq 0 || $(command -v sudo) ]]; then
# Note: this group may not exist on the host OS (MacOS), so the command
# fails. Just ignore the error; chmods are still done and things work OK.
sudo chown -R :$ENV_UNIX_GROUP_WEBSERVER $PERSISTENT_FILES_DIR/$SITE/
# When a custom group is set, ensure sub-directory and files are always
# webserver writable via the setgid bit. This makes the right group to be
# propagated down.
sudo chmod 2775 $PERSISTENT_FILES_DIR/$SITE/public
sudo chmod 2775 $PERSISTENT_FILES_DIR/$SITE/public/translations
sudo chmod 2775 $PERSISTENT_FILES_DIR/$SITE/private
fi
fi

# Move files for existing dev-installations.
Expand All @@ -57,6 +61,8 @@ for SITE in `ls -d web/sites/*/`; do

# Link public files directory to persistent files.
mkdir -p web/sites/$SITE
os_compat_link_directory ../../../$PERSISTENT_FILES_DIR/$SITE/public web/sites/$SITE/files
if [[ ! -L web/sites/$SITE/files ]]; then
os_compat_link_directory ../../../$PERSISTENT_FILES_DIR/$SITE/public web/sites/$SITE/files
fi
done

0 comments on commit 52ad61d

Please sign in to comment.