X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fsystem%2Fadd_apache_site.sh;h=203b0ebdb158d14e0845d985e72c3461b2e78801;hb=36f69c61255add8dbac41ebd2100f6b726c6865e;hp=647b87b9d8a79460679ab302371c4abe75b72a70;hpb=e855cd6aa2d75a11b18c923f9c9ceed8c59ce94a;p=feisty_meow.git diff --git a/scripts/system/add_apache_site.sh b/scripts/system/add_apache_site.sh index 647b87b9..203b0ebd 100644 --- a/scripts/system/add_apache_site.sh +++ b/scripts/system/add_apache_site.sh @@ -4,12 +4,18 @@ # auto-find the scripts, since we might want to run this as sudo. export WORKDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory. -source "$WORKDIR/../core/launch_feisty_meow.sh" +export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )" + +source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh" # some convenient defaults for our current usage. -BASE_PATH="$HOME/apps" -STORAGE_SUFFIX="/public" +if [ -z "$BASE_APPLICATION_PATH" ]; then + BASE_APPLICATION_PATH="$HOME/apps" +fi +if [ -z "$STORAGE_SUFFIX" ]; then + STORAGE_SUFFIX="/public" +fi # this function writes out the new configuration file for the site. function write_apache_config() @@ -37,7 +43,7 @@ function write_apache_config() if [ -z "$site_path" ]; then # path where site gets checked out, in some arcane manner, and which happens to be # above the path where we put webroot (in the storage suffix, if defined). - local path_above="${BASE_PATH}/${appname}" + local path_above="${BASE_APPLICATION_PATH}/${appname}" # no slash between appname and suffix, in case suffix is empty. local full_path="${path_above}${STORAGE_SUFFIX}" #echo really full path is $full_path @@ -64,6 +70,9 @@ function write_apache_config() Include /etc/apache2/conf-library/rewrite-enabling.conf " >"$site_config" + + chown "$(logname):$(logname)" "$site_config" + test_or_die "setting ownership on: $site_config" } # turns on the config file we create above for apache. @@ -101,8 +110,8 @@ function restart_apache() function maybe_create_site_storage() { local our_app="$1"; shift - # make sure the base path for storage of all the apps for this user exists. - local full_path="$BASE_PATH/$our_app" + # make sure the path for storage this app exists for the user. + local full_path="$BASE_APPLICATION_PATH/$our_app" if [ ! -d "$full_path" ]; then mkdir -p $full_path test_or_die "The app storage path could not be created.\n Path in question is: $full_path" @@ -146,7 +155,7 @@ This script needs to know (1) the application name for the new site and appropriate name for a file-system compatible folder name. There is an optional third parameter (3) the path for site storage. If the site path is not provided, we'll use this path: - $BASE_PATH/{app name}/$STORAGE_SUFFIX" + $BASE_APPLICATION_PATH/{app name}/$STORAGE_SUFFIX" exit 1 fi