-# some convenient defaults for our current usage.
-
-BASEPATH="/var/www"
-SHADOWPATH="/srv/users/serverpilot/apps"
-STORAGESUFFIX="/public"
-
-# this function writes out the new configuration file for the site.
-function write_apache_config()
-{
- local appname="$1"; shift
- local sitename="$1"; shift
- local site_config="/etc/apache2/sites-available/${sitename}.conf"
-
- # check if config file already exists and bail if so.
- if [ -f "$site_config" ]; then
- echo "The apache configuration file already exists at:"
- echo " $site_config"
- echo "Please remove this file before proceeding, if it is junk. For example:"
- echo " sudo rm $site_config"
- exit 1
- fi
-
- echo "Creating a new apache2 site for $sitename with config file:"
- echo " $site_config"
-
- local fullpath="${BASEPATH}/${appname}${STORAGESUFFIX}"
-
- # make the storage directory if it's not already present.
- if [ ! -d "$fullpath" ]; then
- mkdir -p "$fullpath"
- if [ $? -ne 0 ]; then
- echo "Failed to create the storage directory for $appname in"
- echo "the folder: $fullpath"
- exit 1
- fi
- fi
+# auto-find the scripts, since we might want to run this as sudo.
+export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"