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

refcodes-batch.1.0.2.source-code.configure-typo3-website.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 given Typo3 config to configure                     " >&2
	echo "the given website accordingly. For example needed symbolic links to the Typo3   " >&2
	echo "sources are in your site's folder. In case your site uses the \"typo3_template\"," >&2
	echo "then links for that are established as well.                                    " >&2
	# echo "--------------------------------------------------------------------------------" >&2
	logSeparator
fi

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

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

exitOnConfigOff "TYPO3"
exitOnConfigOff "WEBSITE"

T3LIB_NAME="t3lib"
TYPO3_NAME="typo3"
TYPO3_SRC_NAME="typo3_src"

# typo3_src
T3LIB_DIR="$TYPO3_DIR/$T3LIB_NAME"
TYPO3_SRC_DIR="$TYPO3_DIR"
TYPO3_SRC_TYPO3_DIR="$TYPO3_DIR/$TYPO3_NAME"

# typo3_template (expected folders):
TYPO3_TEMPLATE_SETUP_DIR="$TYPO3_TEMPLATE_DIR/fileadmin/template/setup"
WEBSITE_FILEADMIN_DIR="$WEBSITE_DIR/fileadmin"

# typo3_template (new folders):
WEBSITE_FILEADMIN_TEMPLATE_DIR="$WEBSITE_FILEADMIN_DIR/template"
SETUP_NAME="setup"

if [[ $VERBOSE = y ]] ; then
	echo "Configuring \"$WEBSITE_DOMAIN_NAME\" for Typo3 ... " >&2
	# echo "--------------------------------------------------------------------------------" >&2
	logSeparator
fi

if [[ $VERBOSE = y ]] ; then
	echo "Assuming the path \"$WEBSITE_DIR\" to exist ..." >&2
	echo "Assuming the path \"$T3LIB_DIR\" to exist ..." >&2
	echo "Assuming the path \"$TYPO3_SRC_TYPO3_DIR\" to exist ..." >&2
	echo "Assuming the path \"$TYPO3_SRC_DIR\" to exist ..." >&2
	# echo "--------------------------------------------------------------------------------" >&2
	logSeparator	
	if [[ $TYPO3_TEMPLATE = y ]] ; then
		echo "Assuming the path \"$TYPO3_TEMPLATE_SETUP_DIR\" to exist ..." >&2
		echo "Assuming the path \"$WEBSITE_FILEADMIN_DIR\" to exist ..." >&2
		# echo "--------------------------------------------------------------------------------" >&2
		logSeparator
	fi
fi

exitOnMissingPropertyPath "WEBSITE_DIR"
exitOnMissingVariablePath "TYPO3_SRC_DIR"
exitOnMissingVariablePath "TYPO3_SRC_TYPO3_DIR"
exitOnMissingVariablePath "T3LIB_DIR"

if [[ $TYPO3_TEMPLATE = y ]] ; then
	exitOnMissingVariablePath "TYPO3_TEMPLATE_SETUP_DIR"
	exitOnMissingVariablePath "WEBSITE_FILEADMIN_DIR"
fi

if [[ $VERBOSE = y ]] ; then
	echo "Detected all neccessary paths, proceeding ..." >&2
	echo "Creating symbolic link from \"$T3LIB_DIR\" to \"$WEBSITE_DIR\" ..." >&2
	echo "Creating symbolic link from \"$TYPO3_SRC_TYPO3_DIR\" to \"$WEBSITE_DIR\" ..." >&2
	echo "Creating symbolic link from \"$TYPO3_SRC_DIR\" to \"$WEBSITE_DIR\" ..." >&2
	# echo "--------------------------------------------------------------------------------" >&2
	logSeparator	
fi

if [ -e $WEBSITE_DIR/$T3LIB_NAME ] ; then
	rm $WEBSITE_DIR/$T3LIB_NAME
	exitOnError "Unable to remove \"$WEBSITE_DIR/$T3LIB_NAME\" !!!"
fi
ln -fs $T3LIB_DIR $WEBSITE_DIR
exitOnError "Unable to link \"$T3LIB_DIR\" to \"$WEBSITE_DIR\" !!!"

if [ -e $WEBSITE_DIR/$TYPO3_NAME ] ; then
	rm $WEBSITE_DIR/$TYPO3_NAME
	exitOnError "Unable to remove \"$WEBSITE_DIR/$TYPO3_NAME\" !!!"
fi
ln -fs $TYPO3_SRC_TYPO3_DIR $WEBSITE_DIR
exitOnError "Unable to link \"$TYPO3_SRC_TYPO3_DIR\" to \"$WEBSITE_DIR\" !!!"

if [ -e $WEBSITE_DIR/$TYPO3_SRC_NAME ] ; then
	rm $WEBSITE_DIR/$TYPO3_SRC_NAME
	exitOnError "Unable to remove \"$WEBSITE_DIR/$TYPO3_SRC_NAME\" !!!"
fi
ln -fs $TYPO3_SRC_DIR $WEBSITE_DIR
exitOnError "Unable to link \"$TYPO3_SRC_DIR\" to \"$WEBSITE_DIR\" !!!"

if [[ $TYPO3_TEMPLATE = y ]] ; then
	if [[ $VERBOSE = y ]] ; then
		echo "Creating symbolic link from \"$TYPO3_TEMPLATE_SETUP_DIR\" to \"$WEBSITE_FILEADMIN_TEMPLATE_DIR\" ..." >&2
		# echo "--------------------------------------------------------------------------------" >&2
		logSeparator
	fi

	makePath -p "$WEBSITE_FILEADMIN_TEMPLATE_DIR" "$WEBSITE_FS_USER" "$WEBSITE_FS_GROUP" "o-rwx,ug+rwx"
	exitOnError "Unable to create directory \"$WEBSITE_FILEADMIN_TEMPLATE_DIR\" !!!"
	
	if [ -e $WEBSITE_FILEADMIN_TEMPLATE_DIR/$SETUP_NAME ] ; then
		rm $WEBSITE_FILEADMIN_TEMPLATE_DIR/$SETUP_NAME
		exitOnError "Unable to remove \"$WEBSITE_FILEADMIN_TEMPLATE_DIR/$SETUP_NAME\" !!!"
	fi

	ln -fs $TYPO3_TEMPLATE_SETUP_DIR $WEBSITE_FILEADMIN_TEMPLATE_DIR
	exitOnError "Unable to link \"$TYPO3_TEMPLATE_SETUP_DIR\" to \"$WEBSITE_FILEADMIN_TEMPLATE_DIR\" !!!"
fi

showSuccess " Typo3 website \"$WEBSITE_DOMAIN_NAME\" configured !"




© 2015 - 2024 Weber Informatics LLC | Privacy Policy