3 # creates a new apache website for a specified domain.
5 # auto-find the scripts, since we might want to run this as sudo.
6 export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
7 export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
9 source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
10 source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"
12 # some convenient defaults for our current usage.
14 if [ -z "$BASE_APPLICATION_PATH" ]; then
15 BASE_APPLICATION_PATH="$FEISTY_MEOW_SCAN_REPOS"
16 #hmmm: take just first item from the repos list!
18 if [ -z "$STORAGE_SUFFIX" ]; then
19 STORAGE_SUFFIX="/public"
22 # main body of script.
24 if [[ $EUID != 0 ]]; then
25 echo "This script must be run as root or sudo."
33 if [ -z "$appname" -o -z "$site" ]; then
34 #hmmm: move to a print_instructions function.
36 $(basename $0): {app name} {dns name} [site path]
38 This script needs to know (1) the application name for the new site and
39 (2) the DNS name for the apache virtual host. The appname should be an
40 appropriate name for a file-system compatible folder name. There is an
41 optional third parameter (3) the path for site storage. If the site path
42 is not provided, we'll use this path:
43 $BASE_APPLICATION_PATH/{app name}$STORAGE_SUFFIX"
47 maybe_create_site_storage "$appname"
48 write_apache_config "$appname" "$site" "$site_path"