# some important retreads on aliases that provide a sudo-ized version of other scripts.
define_yeti_alias snarf_linux_config="sudo -E PERLLIB=\$PERLLIB perl \$FEISTY_MEOW_SCRIPTS/archival/snarf_linux_config.pl"
-define_yeti_alias standup="sudo bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/standup.sh\""
+#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\""
# basic information that is constant for all site avenger sites.
-APPLICATION_DIR="$HOME/apps"
-DEFAULT_REPOSITORY_ROOT="git@github.com:kwentworth"
-CHECKOUT_DIR_NAME="avenger5"
+export APPLICATION_DIR="$HOME/apps"
+export DEFAULT_REPOSITORY_ROOT="git@github.com:kwentworth"
+export CHECKOUT_DIR_NAME="avenger5"
####
# deployment information for the application / site.
-APPLICATION_NAME="${app_dirname}"
+export APPLICATION_NAME="${app_dirname}"
echo app name was computed as $APPLICATION_NAME
# change this if the site is on the "real" internet.
-DOMAIN_NAME="${app_dirname}.vm"
+export DOMAIN_NAME="${app_dirname}.vm"
echo domain name was computed as $DOMAIN_NAME
-REPO_NAME="${app_dirname}.git"
+export REPO_NAME="${app_dirname}"
echo repo name was computed as $REPO_NAME
-THEME_NAME="$(capitalize_first_char "${app_dirname}.git")"
+export THEME_NAME="$(capitalize_first_char "${app_dirname}")"
echo theme name was computed as $THEME_NAME
source "$WORKDIR/config/default.app"
-DOMAIN_NAME="${APPLICATION_NAME}.cakelampvm.com"
+export DOMAIN_NAME="${APPLICATION_NAME}.cakelampvm.com"
# start with. The concept of the theme comes from cakephp.
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"
############################
function print_instructions()
{
echo
- echo "$(basename $0 .sh) [app dirname] [repository] [theme name]"
+ echo "$(basename $0 .sh) [app dirname] [repository] [theme name] "
+#[user name]
echo
echo "All parameters are optional, and intelligent guesses for them will be made."
echo
echo "app dirname: The folder where the app will be stored."
echo "repository: The name of the git repository (short version, no URL)."
echo "theme name: The name to use for the cakephp theme."
+# echo "user name: The name of the user to chown the checkout to."
echo
exit 0
}
app_dirname="$1"; shift
repo_name="$1"; shift
theme_name="$1"; shift
+#user_name="$1"; shift
+
+#echo "*** user name is $user_name"
if [ "$app_dirname" == "-help" -o "$app_dirname" == "--help" ]; then
print_instructions
echo "Theme name: $theme_name"
sep
+echo in powerup before update repo with:
+var CHECKOUT_DIR_NAME DEFAULT_REPOSITORY_ROOT
+
# this should set the site_store_path variable if everything goes well.
update_repo "$full_app_dir" "$CHECKOUT_DIR_NAME" "$DEFAULT_REPOSITORY_ROOT" "$repo_name"
test_or_die "Updating the repository storage directory"
sep
+#if [ ! -z "$user_name" ]; then
+# echo "Chowning the apps folder to be owned by: $user_name"
+##hmmm: have to hope for now for standard group named after user
+# chown -R "$user_name:$user_name" "$APPLICATION_DIR"
+# test_or_die "Chowning $APPLICATION_DIR to be owned by $user_name"
+#fi
+
+sep
+
+
echo "Finished powering up the site in '${app_dirname}'."
local repo_root="$1"; shift
local repo_name="$1"; shift
+echo here are parms in update repo:
+var full_app_dir checkout_dirname repo_root repo_name
+
# forget any prior value, since we are going to validate the path.
unset site_store_path
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.
print_instructions
fi
-if [[ $EUID != 0 ]]; then
- echo "This script must be run as root or sudo."
- exit 1
-fi
+#we will require sudo later.
+#if [[ $EUID != 0 ]]; then
+# echo "This script must be run as root or sudo."
+# exit 1
+#fi
source "$WORKDIR/shared_site_mgr.sh"
test_app_folder "$APPLICATION_DIR" "$app_dirname"
fi
-add_domain "$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
-add_apache_site "$APPLICATION_NAME" "$DOMAIN_NAME"
+sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$DOMAIN_NAME"
test_or_die "Setting up apache site for: $APPLICATION_NAME"
sep
+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.
+# "$(logname)"
sep
# 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.
#
# Author: Chris Koeritz
+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"
+
# some defaults that are convenient for current purposes.
-# hmmm: these would need to be parameterized somehow for this script to become really general.
+
+# hmmm: !!! these would need to be parameterized somehow for this script to become really general.
# in our scheme, the single IP address that all our domains map to.
IP_ADDRESS="10.28.42.20"
# the email address (where first dot is replaced by @) for the administrator of the domain.
-SERVER_ADMIN="fred.cakelampvm.com"
+SERVER_ADMIN="developer.cakelampvm.com"
# the name of the name server for the new domains (should already be configured).
MAIN_NAME_SERVER="ns.cakelampvm.com"
# the name of the mail server for a new domain (should already be configured).