From: Chris Koeritz Date: Mon, 13 Nov 2017 02:57:11 +0000 (-0500) Subject: Merge branch 'dev' of feistymeow.org:feisty_meow into dev X-Git-Tag: 2.140.98^2~2 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=185c9030a042e1e274c3b6af307dace6ada968e4;hp=1ca4705e30eea3b7441d3add4e4dc716b42039a5;p=feisty_meow.git Merge branch 'dev' of feistymeow.org:feisty_meow into dev --- diff --git a/scripts/core/common.alias b/scripts/core/common.alias index fae1b6c6..cfb860d6 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -102,7 +102,7 @@ define_yeti_alias feisty_branch='pushd $FEISTY_MEOW_APEX ; git branch ; popd' # 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\"" diff --git a/scripts/site_avenger/config/default.app b/scripts/site_avenger/config/default.app index 65e782d7..4fe8303c 100644 --- a/scripts/site_avenger/config/default.app +++ b/scripts/site_avenger/config/default.app @@ -6,9 +6,9 @@ # 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" #### @@ -23,20 +23,20 @@ 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 diff --git a/scripts/site_avenger/config/mapsdemo.app b/scripts/site_avenger/config/mapsdemo.app index a2bca519..ab89231b 100644 --- a/scripts/site_avenger/config/mapsdemo.app +++ b/scripts/site_avenger/config/mapsdemo.app @@ -5,6 +5,6 @@ source "$WORKDIR/config/default.app" -DOMAIN_NAME="${APPLICATION_NAME}.cakelampvm.com" +export DOMAIN_NAME="${APPLICATION_NAME}.cakelampvm.com" diff --git a/scripts/site_avenger/powerup.sh b/scripts/site_avenger/powerup.sh index 998fcad5..c67bd25a 100644 --- a/scripts/site_avenger/powerup.sh +++ b/scripts/site_avenger/powerup.sh @@ -21,19 +21,24 @@ # 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 } @@ -46,6 +51,9 @@ function print_instructions() 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 @@ -80,6 +88,9 @@ echo "Repository: $repo_name" 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" @@ -96,5 +107,15 @@ create_site_links "$site_store_path" "$theme_name" 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}'." diff --git a/scripts/site_avenger/shared_site_mgr.sh b/scripts/site_avenger/shared_site_mgr.sh index b30ca82d..3c03ccbe 100644 --- a/scripts/site_avenger/shared_site_mgr.sh +++ b/scripts/site_avenger/shared_site_mgr.sh @@ -167,6 +167,9 @@ function update_repo() 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 @@ -175,10 +178,12 @@ function update_repo() 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" @@ -189,6 +194,7 @@ function update_repo() 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:" @@ -199,18 +205,22 @@ function update_repo() 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. diff --git a/scripts/site_avenger/standup.sh b/scripts/site_avenger/standup.sh index 56684b9c..96ec4cf3 100644 --- a/scripts/site_avenger/standup.sh +++ b/scripts/site_avenger/standup.sh @@ -47,10 +47,11 @@ elif [ -z "$app_dirname" ]; then 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" @@ -66,17 +67,24 @@ else 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 diff --git a/scripts/system/add_apache_site.sh b/scripts/system/add_apache_site.sh index 647b87b9..30ff1f50 100644 --- a/scripts/system/add_apache_site.sh +++ b/scripts/system/add_apache_site.sh @@ -4,7 +4,9 @@ # 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. diff --git a/scripts/system/add_domain.sh b/scripts/system/add_domain.sh index 3c9df992..e6b97fb6 100644 --- a/scripts/system/add_domain.sh +++ b/scripts/system/add_domain.sh @@ -8,13 +8,19 @@ # # 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).