#!/bin/bash BASE_PATH=`pwd` WWW_PATH="$BASE_PATH/public_html" FILES_DIRECTORY='userfiles' THUMBNAILS_DIRECTORY='thumbnails' ASSETS_DIRECTORY='assets' if [ BASE_PATH != '/home/m2' ] ; then echo "ERROR: file '"$(basename $0)"' should be located at '/home/m2'" exit 1 fi # thumbnails ... if [ ! -d "$WWW_PATH/$THUMBNAILS_DIRECTORY" ] ; then mkdir -p $WWW_PATH/$THUMBNAILS_DIRECTORY find $WWW_PATH/$THUMBNAILS_DIRECTORY -type d -exec chmod 777 {} \; find $WWW_PATH/$THUMBNAILS_DIRECTORY -type f -exec chmod 666 {} \; fi if [ ! -f $WWW_PATH/$THUMBNAILS_DIRECTORY/.htaccess ] ; then echo 'Options -Indexes' > $WWW_PATH/$THUMBNAILS_DIRECTORY/.htaccess fi # ... thumbnails # userfiles ... if [ ! -d "$WWW_PATH/$FILES_DIRECTORY" ] ; then mkdir -p $WWW_PATH/$FILES_DIRECTORY find $WWW_PATH/$FILES_DIRECTORY -type d -exec chmod 777 {} \; find $WWW_PATH/$FILES_DIRECTORY -type f -exec chmod 666 {} \; fi if [ ! -f $WWW_PATH/$FILES_DIRECTORY/.htaccess ] ; then echo 'Options -Indexes' > $WWW_PATH/$FILES_DIRECTORY/.htaccess fi if [ ! -d "$WWW_PATH/$FILES_DIRECTORY/pano" ] ; then mkdir -p $WWW_PATH/$FILES_DIRECTORY/pano find $WWW_PATH/$FILES_DIRECTORY -type d -exec chmod 777 {} \; find $WWW_PATH/$FILES_DIRECTORY -type f -exec chmod 666 {} \; fi if [ ! -f $WWW_PATH/$FILES_DIRECTORY/pano/.htaccess ] ; then echo 'Options -Indexes' > $WWW_PATH/$FILES_DIRECTORY/pano/.htaccess echo 'DirectoryIndex index.html' >> $WWW_PATH/$FILES_DIRECTORY/pano/.htaccess fi # ... userfiles # assets ... if [ ! -d "$WWW_PATH/$ASSETS_DIRECTORY" ] ; then mkdir -p $WWW_PATH/$ASSETS_DIRECTORY echo 'Options -Indexes' > $WWW_PATH/$ASSETS_DIRECTORY/.htaccess find $WWW_PATH/$ASSETS_DIRECTORY -type d -exec chmod 777 {} \; find $WWW_PATH/$ASSETS_DIRECTORY -type f -exec chmod 666 {} \; fi # ... thumbnails # clear cache rm -Rf $WWW_PATH/protected/runtime/*