All Downloads are FREE. Search and download functionalities are using the official Maven repository.

refcodes-batch.1.0.2.source-code.fix-typo3-webiste-permissions.job Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
#!/bin/bash

. $SCRIPT_DIR/lib-filesystem.inc

if [[ $HELP = y ]] ; then
	echo "The switch \"-j $JOB\" uses a given configuration to fix                          " >&2
	echo "a typo3 based websit's \"typo3temp\" file permissions and owner. This may be      " >&2
	echo "useful when rsyncing files and folders. Run this jon as root user as we modify    " >&2
	echo "file owner and permissions!                                                       " >&2
	logSeparator
fi

. $SCRIPT_DIR/validate-website-config.job
. $SCRIPT_DIR/validate-typo3-config.job

if [[ $HELP = y ]] ; then
	exit $EXIT_SUCCESS
fi

exitOnConfigOff "WEBSITE"
exitOnConfigOff "TYPO3"

TYPO3TEMP_PATH="${WEBSITE_DIR}/typo3temp"
FILEADMIN_PATH="${WEBSITE_DIR}/fileadmin"

if [ ! -e "${TYPO3TEMP_PATH}" ] ; then
	exitOnError "No such folder \"${TYPO3TEMP_PATH}\" found for fixing owner and permissions !!!"
fi

if [ ! -e "${FILEADMIN_PATH}" ] ; then
	exitOnError "No such folder \"${FILEADMIN_PATH}\" found for fixing owner and permissions !!!"
fi

# ***** TYPO3TEMP *****

# Change owner:
if [[ $VERBOSE = y ]] ; then
	echo "Setting owner to \"${WEBSITE_FS_USER}:${WEBSITE_FS_GROUP}\" for folder \"${TYPO3TEMP_PATH}\" ..." >&2
fi
chown -R ${WEBSITE_FS_USER}:${WEBSITE_FS_GROUP} ${TYPO3TEMP_PATH}/*
exitOnError "Unable to change owner to \"${WEBSITE_FS_USER}:${WEBSITE_FS_GROUP}\" for folder \"${TYPO3TEMP_PATH}\" !!!"

# Change mod:
if [[ $VERBOSE = y ]] ; then
	echo "Changing permissions to \"u+rw,g+rw,o-rwx\" for folder \"${TYPO3TEMP_PATH}\" ..." >&2
fi
chmod -R u+rw,g+rw,o-rwx ${TYPO3TEMP_PATH}/*
exitOnError "Unable to change permissions to \"u+rw,g+rw,o-rwx\" for folder \"${TYPO3TEMP_PATH}\" !!!"

# ***** FILEADMIN *****

# Change owner:
if [[ $VERBOSE = y ]] ; then
	echo "Setting owner to \"${WEBSITE_FS_USER}:${WEBSITE_FS_GROUP}\" for folder \"${FILEADMIN_PATH}\" ..." >&2
fi
chown -R ${WEBSITE_FS_USER}:${WEBSITE_FS_GROUP} ${FILEADMIN_PATH}/*
exitOnError "Unable to change owner to \"${WEBSITE_FS_USER}:${WEBSITE_FS_GROUP}\" for folder \"${FILEADMIN_PATH}\" !!!"

# Change mod:
if [[ $VERBOSE = y ]] ; then
	echo "Changing permissions to \"u+rw,g+rw,o-rwx\" for folder \"${FILEADMIN_PATH}\" ..." >&2
fi
chmod -R u+rw,g+rw,o-rwx ${FILEADMIN_PATH}/*
exitOnError "Unable to change permissions to \"u+rw,g+rw,o-rwx\" for folder \"${FILEADMIN_PATH}\" !!!"

# ***** DONE *****

if [[ $VERBOSE = y ]] ; then
	logSeparator
fi
showSuccess "Changed owner and permissions of \"${TYPO3TEMP_PATH}\" !"




© 2015 - 2024 Weber Informatics LLC | Privacy Policy