

setAppPermissions()
{
	# Do this again, in case this script changed them...
	sudo chown $MY_USER:$MY_GROUP "$SERVICE_FOLDER"
	sudo chmod ug+rwX,o= "$SERVICE_FOLDER"/*
	for pn in "$SERVICE_FOLDER"/* ; do
		if [ -d "$pn" ] ; then
			sudo chown $MY_USER:$MY_GROUP "$pn"
		elif [ -x "$pn" ] ; then
			sudo chgrp $MY_GROUP "$pn"
		else
			sudo chown $MY_USER:$MY_GROUP "$pn"
		fi
	done
	
	# Server executables (set-uid permissions)
	if [ -e "$FCSD_PATH" ]; then
		echo -n "[`$NOW`] Setting correct ownership for Core Server files ... "
		sudo chown root:$MY_GROUP "$FCSD_PATH"
		sudo chmod ug+rwxs,o= "$FCSD_PATH"
		sudo chmod 660 "$FCSDREZ_PATH"
		sudo chmod 770 "$FCPUTIL_PATH"
		sudo chmod 770 "$SERVICE_FOLDER/fclower.pl"
		echo "done."
	fi
	if [ -e "$FCISD_PATH" ]; then
		echo -n "[`$NOW`] Setting correct ownership for Internet Services files ... "
		sudo chown root:$MY_GROUP "$FCISD_PATH"
		sudo chmod ug+rwxs,o= "$FCISD_PATH"
		sudo chmod 660 "$FCISDREZ_PATH"
		echo "done."
	fi
}	


setVolumePermissions()
{
	echo -n "[`$NOW`] Setting correct ownership on content under \"$VOLUMES_PATH\" ... "
	sudo chown -R $MY_USER:$MY_GROUP "$VOLUMES_PATH"
	echo "done."
	echo -n "[`$NOW`] Updating permissions on content under \"$VOLUMES_PATH\" ... "
	sudo chmod -R ug+rwX,o= "$VOLUMES_PATH"
	echo "done."
}

setBatchPermissions()
{
	echo -n "[`$NOW`] Setting correct ownership on batch upgrade content ... "
	sudo chown -R $MY_USER:$MY_GROUP "$BATCH_FOLDER"
	echo "done."
	echo -n "[`$NOW`] Updating permissions on batch upgrade content ... "
	sudo chmod -R ug+rwX,o= "$BATCH_FOLDER"
	echo "done."
}

