Merge branch 'dev' of feistymeow.org:feisty_meow into dev
authorChris Koeritz <fred@gruntose.com>
Sun, 12 Nov 2017 07:43:34 +0000 (07:43 +0000)
committerChris Koeritz <fred@gruntose.com>
Sun, 12 Nov 2017 07:43:34 +0000 (07:43 +0000)
bringing in the newest changes.

20 files changed:
infobase/configuration/cron/aa_cron_defaults.crontab
infobase/feisty_inits/dot.bashrc-normal-user
infobase/feisty_inits/dot.bashrc-root
scripts/core/common.alias
scripts/core/connect_feisty_meow.sh
scripts/core/functions.sh
scripts/core/generate_aliases.pl
scripts/core/inventory.sh
scripts/core/launch_feisty_meow.sh
scripts/core/variables.sh
scripts/customize/fred/refred.sh
scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh
scripts/files/remove_here_if_not_there.sh
scripts/rev_control/rfluffer.sh [deleted file]
scripts/rev_control/rpuffer.sh [new file with mode: 0644]
scripts/rev_control/version_control.sh
scripts/site_avenger/shared_site_mgr.sh
scripts/site_avenger/standup.sh
scripts/system/add_apache_site.sh
scripts/system/add_domain.sh

index 51a73ff46d2a617a2437ec106d33ab7450f11fc9..c8ff3ebe422c2f76cdf9750b78311ab9763181c0 100644 (file)
@@ -23,7 +23,6 @@ SHELL=/bin/bash
 # almost nothing from the user's environment.  this folder needs to be updated
 # for your own particular install location.
 FEISTY_MEOW_APEX=/opt/feistymeow.org/feisty_meow
-#FEISTY_MEOW_APEX=$HOME/feisty_meow
 
 # crontab miniature docs:
 #
index edc83b709a74838dba2be900710ec189e7109121..615970aa422bc56e1a333c0e38a10f6eef792bc7 100644 (file)
@@ -19,10 +19,8 @@ export HISTFILESIZE=8000000
 
 ##############
 
-# system-wide install:
+# system-wide install (will be fixed by connect_feisty_meow script):
 export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow"
-# personal install:
-#export FEISTY_MEOW_APEX="$HOME/feisty_meow"
 
 # sets up the feisty_meow scripts if appropriate for the environment.
 if [ "${TERM}" != "dumb" -a -z "$PBS_ENVIRONMENT" ]; then
index 20a9023fadd3d1f596d6dc5f35b807923395a661..453a0fbd472e64b4557e61728850842eb2dd7cc5 100644 (file)
@@ -19,13 +19,13 @@ export HISTFILESIZE=8000000
 
 ##############
 
-# system-wide install:
+# system-wide install (will be fixed by connect_feisty_meow script):
 export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow"
-# personal install:
-#export FEISTY_MEOW_APEX="$HOME/feisty_meow"
 
 # the "fredme" macro enables the feisty_meow environment.
 alias fredme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"'
+# synonym for fredme.
+alias feistyme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"'
 
 # if not commented out, then feisty meow will run all the unit tests during builds.
 #export RUN_ALL_TESTS=true
index 1a830c84288a9b9a6f42c65c233460567226029d..af3378bf62124599f4b6702cbd91483f6d5c262c 100644 (file)
@@ -9,7 +9,21 @@
 # Feel free to send updates to: [ fred@gruntose.com ]
 ##############
 
-# a list of core aliases for feisty meow codebase.
+# this file provides a list of core aliases for feisty meow codebase.
+
+##############
+
+# call the generated aliases file, if it exists.
+# we do this first so that our core aliases get a chance to override the aliases
+# based on scripts.
+
+if [ -f "$FEISTY_MEOW_LOADING_DOCK/fmc_aliases_for_scripts.sh" ]; then 
+  if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo loading script aliases...; fi
+  source "$FEISTY_MEOW_LOADING_DOCK/fmc_aliases_for_scripts.sh"
+  if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo done loading script aliases.; fi
+fi
+
+##############
 
 # repurposes certain commands that feisty meow does a little differently.
 define_yeti_alias cls='clear_colormap; clear'
@@ -79,6 +93,21 @@ define_yeti_alias up='cd ..'
 
 ##############
 
+# some information about the feisty meow codebase itself.
+
+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 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"
+
+##############
+
 # extended aliases for meta-operations.
 define_yeti_alias dvd_rip='vobcopy -m'
 define_yeti_alias blu_rip='echo "what would this command be?"'
@@ -103,15 +132,6 @@ define_yeti_alias why='echo We all wonder what the point of the universe is at t
 
 ##############
 
-# call the generated aliases file, if it exists.
-if [ -f "$FEISTY_MEOW_LOADING_DOCK/fmc_aliases_for_scripts.sh" ]; then 
-  if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo loading script aliases...; fi
-  source "$FEISTY_MEOW_LOADING_DOCK/fmc_aliases_for_scripts.sh"
-  if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo done loading script aliases.; fi
-fi
-
-##############
-
 # remove the fredization macro if it was defined, helping to avoid running
 # the shell scripts twice for users like root that don't always load this
 # stuff.
index 9a5c81d548bb3b98b6b22e36a3009641f6cdb868..6a226b8dfe3e8c15b4c670e084a2f89154922c58 100644 (file)
@@ -11,16 +11,31 @@ export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
 
 echo calculated apex as $FEISTY_MEOW_APEX
 
+do_root="$1"; shift
+
 if [ -f "$HOME/.bashrc" ] && grep -q "launch_feisty_meow.sh" "$HOME/.bashrc"; then
   # the stanza for loading feisty meow already seems to be present.
   echo "Feisty Meow already seems to be configured in '~/.bashrc'."
 else
-  # stuff the normal user init file into .bashrc.  not appropriate for root probably, but
-  # this is the easy quick start script for normal folks.
-  cat $FEISTY_MEOW_APEX/infobase/feisty_inits/dot.bashrc-normal-user |
-    sed -e \
-      "s?FEISTY_MEOW_APEX=\".*\"?FEISTY_MEOW_APEX=\"$FEISTY_MEOW_APEX\"?" \
-      >> "$HOME/.bashrc"
-  echo "Feisty Meow is now configured in '~/.bashrc'."
+  # check for the --root flag to see if they're trying to get the root version of inits.
+  if [ "$do_root" != "--root" ]; then
+    # stuff the "normal user" init file into .bashrc.  not appropriate for root.
+    # this is the easy and quick start script for most folks.
+    cat $FEISTY_MEOW_APEX/infobase/feisty_inits/dot.bashrc-normal-user |
+      sed -e \
+        "s?FEISTY_MEOW_APEX=\".*\"?FEISTY_MEOW_APEX=\"$FEISTY_MEOW_APEX\"?" \
+        >> "$HOME/.bashrc"
+    echo "Feisty Meow is now configured in '~/.bashrc' for standard users."
+  else
+    # stuff the root user init file into .bashrc.  this one doesn't automatically load
+    # feisty meow.  instead, it provides a fredme macro to load the feisty meow scripts.
+    # fredme comes from the main author being fred t. hamster.  we have since added a
+    # feistyme macro too, to be less personalized...
+    cat $FEISTY_MEOW_APEX/infobase/feisty_inits/dot.bashrc-root |
+      sed -e \
+        "s?FEISTY_MEOW_APEX=\".*\"?FEISTY_MEOW_APEX=\"$FEISTY_MEOW_APEX\"?" \
+        >> "$HOME/.bashrc"
+    echo "Feisty Meow is now configured in '~/.bashrc' for the root user."
+  fi
 fi
 
index 9dcfce80b35a5565c50868bf5f8cecb5707b24d9..6797708525179750e9e84c5de98e4b211c44c2de 100644 (file)
@@ -363,14 +363,15 @@ if [ -z "$skip_all" ]; then
   # sudo function wraps the normal sudo by ensuring we replace the terminal
   # label if they're doing an su with the sudo.
   function sudo() {
-#    local first_command="$1"
     save_terminal_title
     /usr/bin/sudo "$@"
+    retval=$?
     restore_terminal_title
 #    if [ "$first_command" == "su" ]; then
 #      # yep, they were doing an su, but they're back now.
 #      label_terminal_with_info
 #    fi
+    return $retval
   }
   
   # trashes the .#blah files that cvs and subversion leave behind when finding conflicts.
index 4ed01fb74641794fe21613eeb98ee0d4e35d1513..99f17cfd7e906137c6e257ce60a7024447889f9a 100644 (file)
@@ -43,11 +43,10 @@ sub make_alias {
 sub make_bash_alias {
   local($aliasname) = shift(@_);
   local($full_alias) = $aliasname;
+#print "full alias is $full_alias\n";
   $aliasname =~ s/^.*\/([^\/]*)/\1/;
 #print "alias became $aliasname\n";
-  local($source_dir) = shift(@_);
-#print "bash alias is $aliasname, dir is $source_dir\n";
-  print she "define_yeti_alias $aliasname=\"bash $source_dir/$full_alias.sh\"\n";
+  print she "define_yeti_alias $aliasname=\"bash $full_alias.sh\"\n";
 }
 
 # makes an alias for a perl script given the alias name.
@@ -56,9 +55,7 @@ sub make_perl_alias {
   local($full_alias) = $aliasname;
   $aliasname =~ s/^.*\/([^\/]*)/\1/;
 #print "alias became $aliasname\n";
-  local($source_dir) = shift(@_);
-#print "perl alias is $aliasname, dir is $source_dir\n";
-  print she "define_yeti_alias $aliasname=\"perl $source_dir/$full_alias.pl\"\n";
+  print she "define_yeti_alias $aliasname=\"perl $full_alias.pl\"\n";
 }
 
 ##############
index e2290d5afccd8102d67c6530bcf1bfd7b677b2b5..eeb77039ad4cacc95c434ceeec771214b76370d3 100644 (file)
@@ -46,17 +46,11 @@ else
 fi
 echo
 echo "it is $(date +"%A at %H:%M hours on day %e of the %B moon in the gregorian year %Y" | tr A-Z a-z) and our intrepid adventurer $USER is exploring a computer named $(hostname) that is running in a thoughtspace called $osname $osver (code-name $codename), and $USER has deduced that the machine's OS platform is $(uname -m) and its current incarnation has been ${up}." | $splitter 
-#hmmm: splitter not accepting these args properly right now:
-#--mincol 2 --maxcol 40
 echo
-#echo '++++++++++++++++++++++++++++++++++++++++++'
-#echo
 echo "the following things appear to be lying around here..."
 echo
 ls -hFC $color_add
 echo
-#echo '++++++++++++++++++++++++++++++++++++++++++'
-#echo
 echo "there appear to be these entities on this host..."
 echo
 who -suT
index 241e2a0f1be5f39093c916515594bedf33c98bc7..a9db25b406c23e37b5f6275c86f975df640a37c4 100644 (file)
@@ -67,7 +67,7 @@ runs.  Check \$HOME/.bashrc to see if a change there will fix the problem.
 "
 else
   # apex is good, so let's make the scripts good too.
-  if [ ! -d "$FEISTY_MEOW_SCRIPTS" ]; then
+  if [ -z "$FEISTY_MEOW_SCRIPTS" -o ! -d "$FEISTY_MEOW_SCRIPTS" ]; then
     export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_APEX/scripts"
   fi
   # check again to test our belief system...
@@ -77,11 +77,6 @@ else
   fi
 fi
 
-#; /bin/bash -i --norc --noprofile\" > \$HOME/fm-fix 
-#; exec /bin/bash -i --norc --noprofile -c 'bash \$HOME/fm-fix ; echo hello ; read line'
-#--norc --noprofile 
-#; source \$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh
-
 if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
 
   # we believe it's safe to run through the rest of this script.
index b6311dacff8517b02357178abcc4ff9a3f09ab6f..a937d05dba10fa66be708817bc2c096956ff0f7a 100644 (file)
@@ -149,11 +149,15 @@ define_yeti_variable DEFAULT_FEISTYMEOW_ORG_DIR=/opt/feistymeow.org
   
   ##############
 
-  # umask sets a permission mask for all file creations.
-  # this mask disallows writes by "group" and "others".
-  umask 022
-  # this mask disallows writes by the "group" and disallows "others" completely.
+  # umask sets a permission mask for all file creations.  we don't set this for the users any
+  # more; they should set it themselves.  this is just documentation.
+  # 
+  # this mask disallows writes by the "group" and disallows all permissions for "others".
   #umask 027
+  # this mask disallows writes by "group" and "others".
+  #umask 022
+  # this mask allows writes by "group" but not by "others".
+  #umask 002
 
   # ulimit sets user limits.  we set the maximum allowed core dump file size
   # to zero, because it is obnoxious to see the core dumps from crashed
index 2f00854a2c675b44ff9738dd50460cae6de3571b..c99b2d11fde01fb8766592e27943504ab258f0f9 100644 (file)
@@ -19,30 +19,41 @@ function refred()
   # everything else is only re-permed if it exists.
   if [ ! -d "$DEFAULT_FEISTYMEOW_ORG_DIR" ]; then
     sudo mkdir "$DEFAULT_FEISTYMEOW_ORG_DIR"
+    test_or_die "making directory: $DEFAULT_FEISTYMEOW_ORG_DIR"
   fi
 
   # iterate across the list of dirs we want fred to own and change their ownership.
   for dirname in /home/fred $DEFAULT_FEISTYMEOW_ORG_DIR /usr/local/fred /home/games $arch_addin; do
     if [ -d "$dirname" ]; then
       echo "refred on '$dirname'"
-      sudo chown -R fred:fred $dirname
+      sudo chown -R fred:fred "$dirname"
+      test_or_die "chowning for fred: $dirname"
     fi
   done
 
   # special case for archives directory.
   if [ -d /z/stuffing -o -L /z/stuffing ]; then
-    sudo chown fred:fred /z; sudo chmod g+rx,o+rx /z
-    sudo chown fred:fred /z/stuffing; sudo chmod g+rx,o-rwx /z/stuffing
+    sudo chown fred:fred /z
+    test_or_die "chowning /z for fred"
+    sudo chmod g+rx,o+rx /z
+    test_or_die "chmodding /z/ for fred"
+    sudo chown fred:fred /z/stuffing
+    test_or_die "chowning /z/stuffing for fred"
+    sudo chmod g+rx,o-rwx /z/stuffing
+    test_or_die "chmodding /z/stuffing for fred"
     pushd /z/stuffing &>/dev/null
     if [ -d archives -o -L archives ]; then
       sudo chown fred:fred archives
+      test_or_die "chowning /z/stuffing/archives for fred"
       sudo chmod -R g+rwx archives
+      test_or_die "chmodding /z/stuffing/archives for fred"
     fi
     popd &>/dev/null
   fi
 
   # make the logs readable by normal humans.
   sudo bash $FEISTY_MEOW_SCRIPTS/security/normal_perm.sh /var/log
+  test_or_die "setting normal perms on /var/log"
 }
 
 # this block should execute when the script is actually run, rather
@@ -50,6 +61,8 @@ function refred()
 if [[ $0 =~ .*refred\.sh.* ]]; then
   THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )"
   source "$THISDIR/../../core/launch_feisty_meow.sh"
+  test_or_die "sourcing the feisty meow launcher"
   refred
+  test_or_die "refredding process"
 fi
 
index af9693f076f5653eb20f824797a44ff3049d5f52..f474b2dab1490cfd8d09a0f63d91f4d40a8f5598 100755 (executable)
@@ -1,21 +1,42 @@
 
-# change the owner for the web roots to the apache user, www-data.
-sudo chown -R www-data:www-data                /var/www
+# fixes the cakelampvm permissions according to the way.
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+
+##############
+
+if (( $EUID != 0 )); then
+  echo "This script must be run as root or sudo."
+  exit 1
+fi
+
+##############
 
 # make sure we have the appropriate access on a few key folders.
-sudo chmod u+rwx,g+rx                  /var/www
+normal_perm /var/www
+
+##############
+
+# change the owner for the web roots to the apache user, www-data.
+sudo chown -R www-data:www-data /var/www
 
 # put a couple specific ownerships into play so the appropriate user has full access.
-sudo chown -R developer:developer      /var/www/defaultcake.cakelampvm.com
-sudo chown -R fred:fred                        /var/www/webwork.repository
-## add others here for your own projects.
+sudo chown -R developer:developer /home/developer \
+  /etc/apache2 \
+  /etc/bind \
 
-# these directories will be given group permissons that enable web server access.
-DIR_LIST="/var/www/defaultcake.cakelampvm.com /var/www/webwork.repository"
 
-# add in group permissions to allow the web server to serve the pages properly.
-for currdir in $DIR_LIST; do
-  sudo find $currdir -type d -exec chmod -R u+rwx,g+rwx,o-rwx {} ';'
-  sudo find $currdir -type f -exec chmod -R u+rw,g+rw,o-rwx {} ';'
-done
+sudo chown -R fred:fred        /home/fred \
+  /opt/feistymeow.org \
+  /home/archives/stuffing \
+
+
+##############
+
+# these directories will be given group permissons that enable web server access.
+group_perm /var/www/html \
+  /opt/feistymeow.org \
+  /etc/apache \
+  /
 
+##############
index 6ba6a4e3f0dd1f46d7862101a4636114becc4857..ba0d8dff1fff4d8e37edc929d5612911eb4c72b5 100644 (file)
@@ -3,8 +3,13 @@
 function print_instructions()
 {
   echo -e "\n$(basename $0 .sh):\n"
+
+#hmmm: extract to a terminal size function.
+# calculate the number of columsn in the terminal.
+cols=$(stty size | awk '{print $2}')
+
   echo -e 'this script takes two parameters, a "here" folder and a "there" folder, almost as if it were a copy command.  but instead, this removes any file from under the "here" location if it cannot be found in the "there" location.  so the "there" location is considered a more definitive template of what should be in "here", such that we strip out what "there" does not have.\n\n
-the most" useful way to use this script is for a "here" hierarchy that is a copy of an older version of another "there" hierarchy.  the "there" hierarchy may have changed a lot, including new files, changed files, and deleted files.  it is a simple operation to copy everything from "there" into "here" (such as by using the command [ cp -R "$there"/* "$here" ] ) , but it is a lot harder to determine what stuff in "here" is out of date and should be removed.  that is where this script comes in; it can be run to flush out any older things in "here", rather than requiring the user to manually find all those files.  ' | splitter
+the most" useful way to use this script is for a "here" hierarchy that is a copy of an older version of another "there" hierarchy.  the "there" hierarchy may have changed a lot, including new files, changed files, and deleted files.  it is a simple operation to copy everything from "there" into "here" (such as by using the command [ cp -R "$there"/* "$here" ] ) , but it is a lot harder to determine what stuff in "here" is out of date and should be removed.  that is where this script comes in; it can be run to flush out any older things in "here", rather than requiring the user to manually find all those files.  ' | splitter --maxcol $(($cols - 1))
   echo
   echo "Example Usage:"
   echo 
diff --git a/scripts/rev_control/rfluffer.sh b/scripts/rev_control/rfluffer.sh
deleted file mode 100644 (file)
index b5de908..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-# this "fluffs out" the repositories that it finds.  what this means is that
-# any git repositories found will have all of their remote state updated (by
-# pulling all remote repos).  this ensures that any upstream changes get
-# merged into the local branch.
-# it's better to fluff out your code regularly rather than waiting for a huge
-# merge snarl later.  note that if you check in the code frequently with the
-# feisty meow scripts, that will also take care of fluffing out the code.
-
-source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
-source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
-
-##############
-
-dir="$1"; shift
-if [ -z "$dir" ]; then
-  dir=.
-fi
-
-pushd "$dir" &>/dev/null
-test_or_die "changing to directory: $dir"
-tempfile=$(generate_rev_ctrl_filelist)
-test_or_die "generating revision control file list"
-popd &>/dev/null
-
-perform_revctrl_action_on_file "$tempfile" do_careful_git_update
-test_or_die "fluffing out repository at: $tempfile"
-
diff --git a/scripts/rev_control/rpuffer.sh b/scripts/rev_control/rpuffer.sh
new file mode 100644 (file)
index 0000000..5032bc1
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# this "puffs out" the repositories that it finds.  what this means is that
+# any git repositories found will have all of their remote state updated (by
+# pulling all remote repos).  this ensures that any upstream changes get
+# merged into the local branch.
+# it's better to puff out your code regularly rather than waiting for a huge
+# merge snarl later.  note that if you check in the code frequently with the
+# feisty meow scripts, that will also take care of puffing out the code.
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+source "$FEISTY_MEOW_SCRIPTS/rev_control/version_control.sh"
+
+##############
+
+dir="$1"; shift
+if [ -z "$dir" ]; then
+  dir=.
+fi
+
+pushd "$dir" &>/dev/null
+test_or_die "changing to directory: $dir"
+tempfile=$(generate_rev_ctrl_filelist)
+test_or_die "generating revision control file list"
+popd &>/dev/null
+
+perform_revctrl_action_on_file "$tempfile" do_careful_git_update
+test_or_die "puffing out repository at: $tempfile"
+
index 491dd17c1cc9ed5439eea6461f194ba381b13cd9..7656dc1003c453617fae7b9f3ae0b326da8d9e1a 100644 (file)
@@ -17,6 +17,11 @@ export MAX_DEPTH=5
 # use our splitter tool for lengthy output if it's available.
 if [ ! -z "$(which splitter)" ]; then
   TO_SPLITTER="$(which splitter)"
+
+#hmmm: another reusable chunk here, getting terminal size.
+  # calculate the number of columsn in the terminal.
+  cols=$(stty size | awk '{print $2}')
+  TO_SPLITTER+=" --maxcol $(($cols - 1))"
 else
   TO_SPLITTER=cat
 fi
@@ -444,8 +449,8 @@ function generate_rev_ctrl_filelist()
 
   local sortfile=$(mktemp /tmp/zz_checkin_sort.XXXXXX)
   sort <"$tempfile" >"$sortfile"
-  \rm "$tempfile"
   echo "$sortfile"
+  \rm "$tempfile"
 }
 
 # iterates across a list of directories contained in a file (first parameter).
@@ -480,6 +485,6 @@ function perform_revctrl_action_on_file()
 
   restore_terminal_title
 
-  rm $tempfile
+  rm "$tempfile"
 }
 
index 580b896d9a634a7b9f193d03e85e3b4edefbec27..b30ca82dbb600bafdabd11d5be5fecd8810c89f2 100644 (file)
 
 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 
-# get our configuration loaded.
+# get our configuration loaded, if we know the config file.
+# if there is none, we will use our default version.
 export SITE_MANAGEMENT_CONFIG_FILE
 if [ -z "$SITE_MANAGEMENT_CONFIG_FILE" ]; then
   SITE_MANAGEMENT_CONFIG_FILE="$WORKDIR/config/default.app"
 fi
+
+# load in at least the default version to get us moving.
 source "$SITE_MANAGEMENT_CONFIG_FILE"
 test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
 
@@ -83,6 +86,25 @@ function find_app_folder()
   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.
index 762bd1ef6e8ba20e26e171fa99f7c6757fecbb66..47e1aeecf8f5ae989b3339189a044a32e95dea2e 100644 (file)
@@ -7,6 +7,9 @@
 # is much more powerful if the site is based on cakephp and site avenger.
 
 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"
 
 ############################
 
@@ -16,6 +19,13 @@ function print_instructions()
   echo "$(basename $0 .sh) {app name}"
   echo
   echo "
+$(basename $0 .sh) will completely set up a web site, including a domain
+name and an apache configuration file.  The site will be acquired from a
+git repository and configured.  At the end of this script, the result should 
+be an almost working website; you may need to fix the site configuration,
+create databases and so forth.
+
+This script must be run as sudo or root; it makes changes to system files.
 app name: The app name parameter is mandatory.  The configuration file for
 this script will be derived from the app name (e.g. if the app name is MyApp,
 then the config file will be 'MyApp.config').  The config files are by
@@ -31,61 +41,23 @@ overridden by setting the SITE_MANAGEMENT_CONFIG_FILE environment variable."
 # check for parameters.
 app_dirname="$1"; shift
 
-if [ -z "$app_dirname" ]; then
-  print_instructions
-fi
-
-source "$WORKDIR/shared_site_mgr.sh"
-
 if [ "$app_dirname" == "-help" -o "$app_dirname" == "--help" ]; then
   print_instructions
+elif [ -z "$app_dirname" ]; then
+  print_instructions
 fi
 
-sep
-
-check_application_dir "$APPLICATION_DIR"
-
-add_domain "$DOMAIN_NAME"
-test_or_die "Setting up domain: $DOMAIN_NAME"
-
-add_apache_site "$APPLICATION_NAME" "$DOMAIN_NAME"
-test_or_die "Setting up apache site for: $APPLICATION_NAME"
-
-powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
-
-
-
+if (( $EUID != 0 )); then
+  echo "This script must be run as root or sudo."
+  exit 1
+fi
 
+source "$WORKDIR/shared_site_mgr.sh"
 
 sep
 
-echo "
-Finished standing up the full domain and site in:
-${app_dirname}"
-
-#leave before old crud below
-exit 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+check_application_dir "$APPLICATION_DIR"
 
-#below is probably not needed.
 # find proper webroot where the site will be initialized.
 if [ -z "$app_dirname" ]; then
   # no dir was passed, so guess it.
@@ -94,36 +66,21 @@ else
   test_app_folder "$APPLICATION_DIR" "$app_dirname"
 fi
 
-# where we expect to find our checkout folder underneath.
-full_app_dir="$APPLICATION_DIR/$app_dirname"
-
-# use our default values for the repository and theme if they're not provided.
-if [ -z "$repo_name" ]; then
-  repo_name="$app_dirname"
-fi
-if [ -z "$theme_name" ]; then
-  theme_name="$(capitalize_first_char ${app_dirname})"
-fi
+add_domain "$DOMAIN_NAME"
+test_or_die "Setting up domain: $DOMAIN_NAME"
 
-echo "Repository: $repo_name"
-echo "Theme name: $theme_name"
 sep
 
-# 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"
-
-# update the site to load dependencies.
-sep
-composer_repuff "$site_store_path"
-test_or_die "Installing site dependencies with composer"
+add_apache_site "$APPLICATION_NAME" "$DOMAIN_NAME"
+test_or_die "Setting up apache site for: $APPLICATION_NAME"
 
-# set up the symbolic links needed to achieve siteliness.
 sep
 
-create_site_links "$site_store_path" "$theme_name"
+powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
 
 sep
 
-echo "Finished powering up the site in '${app_dirname}'."
+echo "
+Finished standing up the full domain and site in:
+${app_dirname}"
 
index e99f371a1dec349de0c82cb79635c132d2044c42..6be31c8c7b640f91edc98b59db0c309b7189b8dd 100644 (file)
@@ -24,9 +24,9 @@ function write_apache_config()
   if [ -f "$site_config" ]; then
     echo "The apache configuration file already exists at:"
     echo "  $site_config"
-    echo "Please remove this file before proceeding, if it is junk.  For example:"
-    echo "  sudo rm $site_config"
-    exit 1
+    echo "Since apache configuration files can get very complex, we do not want to"
+    echo "assume that this file is removable.  Calling the site addition done."
+    exit 0
   fi
 
   echo "Creating a new apache2 site for $sitename with config file:"
index 0dabaf2e7b4234392fe214883a4fdd6c3e07e94b..e0a6fb48613ffdfacd6f3c283657e20aae059ad8 100644 (file)
@@ -33,11 +33,13 @@ function write_new_domain_file()
   echo "using the config file: $domain_file"
 
   if [ -f $domain_file ]; then
+    echo
     echo "The domain configuration file already exists at:"
     echo "  $domain_file"
-    echo "Please remove this file before proceeding, if it is junk.  For example:"
-    echo "  sudo rm $domain_file"
-    exit 1
+    echo "Since we don't want to tear that down if it has specialized configuration"
+    echo "data in it, we will just leave it in place and consider our job done."
+    echo
+    exit 0
   fi
 
   echo "