#no, does its own sudo wrangling.edefine_yeti_alias standup="sudo bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/standup.sh\""
#hmmm: some magma intrusions from the fred customizations...
-define_yeti_alias revamp_web_permissions="sudo bash \"$FEISTY_MEOW_SCRIPTS/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh\""
+define_yeti_alias revamp_cakelampvm="sudo bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/revamp_cakelampvm.sh\""
##############
+++ /dev/null
-#!/bin/bash
-
-# fixes the cakelampvm permissions according to the way.
-
-##############
-
-if [[ $EUID != 0 ]]; then
- echo "This script must be run as root or sudo."
- exit 1
-fi
-
-##############
-
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../../../../.." && \pwd )"
-
-source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
-
-##############
-
-# fix up the main web storage.
-chown -R www-data:www-data /var/www
-group_perm /var/www
-
-##############
-
-# set up access on some important folders for the developer user.
-chown -R developer:developer /home/developer
-harsh_perm /home/developer/.ssh
-chown -R developer:developer /opt/feistymeow.org
-group_perm /opt/feistymeow.org
-chown -R developer:developer /etc/apache2 /etc/bind
-group_perm /etc/apache2 /etc/bind
-
-##############
-
-# fix perms for fred user.
-chown -R fred:fred /home/fred /home/archives/stuffing
-harsh_perm /home/fred/.ssh
-
-##############
-
#!/bin/bash
-# this config file provides the default values for the variables used in our site management scripts.
+# provides the default values for the variables used in our site management scripts.
+
+# config files for site avenger apps usually override nothing, since we
+# auto-construct the app name and domain.
+# if they do need to override anything, they can just specify replacement
+# values for the variables in this file.
####
####
-# config files for site avenger apps usually override nothing, since we
-# auto-construct the app name and domain. but if they do need to override
-# anything, it will be below this point in the file.
-# the derived config file should include the basic configs like so:
-#
-# source "$WORKDIR/config/default.app"
-
-####
-
# deployment information for the application / site.
export APPLICATION_NAME="${app_dirname}"
# a special override for the mapsdemo site, which we want to put in as
# a subdomain of the cakelampvm domain.
-source "$WORKDIR/config/default.app"
-
export DOMAIN_NAME="${APPLICATION_NAME}.cakelampvm.com"
+echo "*** overrode domain name as: $DOMAIN_NAME"
+
--- /dev/null
+#!/bin/bash
+
+# fixes the cakelampvm permissions according to the way.
+
+##############
+
+if [[ $EUID != 0 ]]; then
+ echo "This script must be run as root or sudo."
+ exit 1
+fi
+
+##############
+
+export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+
+source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
+
+##############
+
+# fix up the main web storage.
+chown -R www-data:www-data /var/www
+group_perm /var/www
+
+##############
+
+# set up access on some important folders for the developer user.
+chown -R developer:developer /home/developer
+harsh_perm /home/developer/.ssh
+chown -R developer:developer /opt/feistymeow.org
+group_perm /opt/feistymeow.org
+chown -R developer:developer /etc/apache2 /etc/bind
+group_perm /etc/apache2 /etc/bind
+
+##############
+
+# fix perms for fred user.
+chown -R fred:fred /home/fred /home/archives/stuffing
+harsh_perm /home/fred/.ssh
+
+##############
+
export SITE_MANAGEMENT_CONFIG_FILE
if [ -z "$SITE_MANAGEMENT_CONFIG_FILE" ]; then
SITE_MANAGEMENT_CONFIG_FILE="$WORKDIR/config/default.app"
+ echo "Site management config file was not set. Using default:"
+ echo " $SITE_MANAGEMENT_CONFIG_FILE"
fi
# load in at least the default version to get us moving.
fi
}
+# tries to find an appropriate config file for the application.
+function locate_config_file()
+{
+ local app_dirname="$1"; shift
+
+ local configfile="$WORKDIR/config/${app_dirname}.app"
+echo hoping config file would be: $configfile
+ if [ ! -f "$configfile" ]; then
+ # this is not a good config file. we can't auto-guess the config.
+ echo -e "
+There is no specific site configuration file in:
+ $configfile
+We will continue onward using the default and hope that this project follows
+the standard pattern for cakephp projects."
+ # we'll pull in the default config file we set earlier; this will
+ # reinitialize some variables based on the app name.
+ else
+ # they gave us a valid config file. let's try using it.
+ export SITE_MANAGEMENT_CONFIG_FILE="$configfile"
+ fi
+
+ # try to load the config.
+ source "$SITE_MANAGEMENT_CONFIG_FILE"
+ test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
+
+}
+
# this function will seek out top-level directories in the target directory passed in.
# if there is only one directory, then it is returned (in the app_dirname variable).
# otherwise, the user is asked which directory to use.
test_or_die "Testing application folder: $app_dirname"
echo "Application folder is: $app_dirname"
-
- local configfile="$WORKDIR/config/${app_dirname}.app"
- if [ ! -f "$configfile" ]; then
- # this is not a good config file. we can't auto-guess the config.
- echo -e "
-There is no specific site configuration file in:
- $configfile
-We will continue onward using the default and hope that this project follows
-the standard pattern for cakephp projects."
- # we'll pull in the default config file we set earlier; this will
- # reinitialize some variables based on the app name.
- else
- # they gave us a valid config file. let's try using it.
- SITE_MANAGEMENT_CONFIG_FILE="$configfile"
- fi
-
- # try to load the config.
- source "$SITE_MANAGEMENT_CONFIG_FILE"
- test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
}
# ensures that the app directory name is valid.
mkdir "$combo"
test_or_die "Making application directory when not already present"
fi
+
+ locate_config_file "$dir"
}
# eases some permissions to enable apache to write log files and do other shopkeeping.
local complete_path="$full_app_dir/$checkout_dirname"
-echo A
# see if the checkout directory exits. the repo_found variable is set to
# non-empty if we find it and it's a valid git repo.
repo_found=
if [ -d "$checkout_dirname" ]; then
-echo B
# checkout directory exists, so let's check it.
pushd "$checkout_dirname" &>/dev/null
test_or_die "Switching to our checkout directory: $checkout_dirname"
repo_found=yes
fi
-echo C
# we don't consider the state of having the dir exist but the repo be wrong as good.
if [ -z "$repo_found" ]; then
echo "There is a problem; this folder is not a valid repository:"
popd &>/dev/null
fi
-echo D
if [ ! -z "$repo_found" ]; then
# a repository was found, so update the version here and leave.
-echo E
echo "Repository $repo_name exists. Updating it."
rgetem
test_or_die "Recursive checkout on: $complete_path"
else
-echo F
# clone the repo since it wasn't found.
echo "Cloning repository $repo_name now."
git clone "$repo_root/$repo_name.git" $checkout_dirname
test_or_die "Git clone of repository: $repo_name"
fi
-echo G
fix_site_perms "$complete_path"
# construct the full path to where the app will actually live.
test_app_folder "$APPLICATION_DIR" "$app_dirname"
fi
-echo "!! domain being added is: $DOMAIN_NAME"
+#echo "!! domain being added is: $DOMAIN_NAME"
sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_domain.sh" "$DOMAIN_NAME"
test_or_die "Setting up domain: $DOMAIN_NAME"
sep
-echo about to do powerup with: app="$APPLICATION_NAME" repo="$REPO_NAME" theme="$THEME_NAME"
-echo default repo is "$DEFAULT_REPOSITORY_ROOT"
+#echo about to do powerup with: app="$APPLICATION_NAME" repo="$REPO_NAME" theme="$THEME_NAME"
+#echo default repo is "$DEFAULT_REPOSITORY_ROOT"
powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
# pass the real user name who should own the files.
sep
echo "
-Finished standing up the full domain and site in:
-${app_dirname}"
+Finished standing up the full domain and site for: ${app_dirname}
+The domain name is: $DOMAIN_NAME
+"
Include /etc/apache2/conf-library/rewrite-enabling.conf
</VirtualHost>
" >"$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.
${domain_name}. IN A ${IP_ADDRESS}
IN HINFO \"linux server\" \"${DISTRO}\"
" >"$domain_file"
+
+ # our personalized configuration approach wants the real owner to own the file.
+ chown "$(logname):$(logname)" $domain_file
+ test_or_die "setting ownership on: $domain_file"
}
# hooks up a new config file into bind's list of zones.
////////////////////////////////////////////////////////////////////////////
" >> /etc/bind/named.conf.local
+
+ # keep ownership for the real user.
+ chown "$(logname):$(logname)" /etc/bind/named.conf.local
+ test_or_die "setting ownership on: /etc/bind/named.conf.local"
+
}
# adds a new subdomain under a containing domain.
IN HINFO \"linux server\" \"${DISTRO}\"
" >> /etc/bind/${containing_domain}.conf
+ # keep ownership for real user.
+ chown "$(logname):$(logname)" "/etc/bind/${containing_domain}.conf"
+ test_or_die "setting ownership on: /etc/bind/${containing_domain}.conf"
}
function restart_bind()