You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
461 B

  1. #!/bin/bash
  2. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. WP_CONTENT_DIRS=(
  4. plugins
  5. upgrade
  6. uploads
  7. themes
  8. )
  9. export WEB_GID=33
  10. perms() {
  11. sudo chown -R $UID:$WEB_GID "$1"
  12. sudo chmod -R g+rwx "$1"
  13. }
  14. permsFile() {
  15. sudo chown $UID:$WEB_GID "$1"
  16. sudo chmod g+rw "$1"
  17. }
  18. for DIR in "${WP_CONTENT_DIRS[@]}"; do
  19. DIR="$SCRIPT_DIR/../wp-content/$DIR"
  20. if [[ -f $DIR ]]; then
  21. permsFile "$DIR"
  22. else
  23. perms "$DIR"
  24. fi
  25. done