Skip to content

Instantly share code, notes, and snippets.

@MaxLazar
Created July 12, 2019 14:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save MaxLazar/928848211f56bd1f244511e2d0574b6e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Find location of this script.
# This ensures that only files in the directory in
# which this script exists (recursively) are modified.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Set what the name of your expressionengine folders are.
SYSTEM="system"
IMAGES_DIR="public_html/images"
UPLOADS_DIR="public_html/files"
# Optionally ensure correct ownership on per environment basis.
#if [ "$DIR" = "/path/to/project/" ]; then
# chown -R http.http "$DIR"
#fi
# Expressionengine specific permissions.
find "$DIR" -type d -print0 | xargs -0 chmod 0755
find "$DIR" -type f -print0 | xargs -0 chmod 0644
find "$DIR/$IMAGES_DIR/" -type d -print0 | xargs -0 chmod -R go+w
find "$DIR/$UPLOADS_DIR/" -type d -print0 | xargs -0 chmod -R go+w
chmod -R go+w "$DIR/$SYSTEM/user/templates"
chmod -R go+w "$DIR/$SYSTEM/user/cache"
chmod 0666 "$DIR/$SYSTEM/user/config/config.php"
# Permissions specific to the sitemap generator
# from http://www.xml-sitemaps.com/.
#chmod -R 0777 "$DIR/public_html/generator/data"
#chmod 0666 "$DIR/public_html/sitemap.xml"
#chmod 0666 "$DIR/public_html/ror.xml"
#chmod 0600 "$DIR/public_html/index.php"
# If laxative is being used, preserve executability
#if [ -e "$DIR/.db/lax" ]; then
# chmod 0700 "$DIR/.db/lax"
#fi
# Make sure other shell scripts are executable too.
find "$DIR" -type f -name "*.sh" -print0 | xargs -0 chmod 700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment