Merge branch 'dev' of feistymeow.org:feisty_meow into dev
authorChris Koeritz <fred@gruntose.com>
Mon, 13 Nov 2017 04:20:19 +0000 (23:20 -0500)
committerChris Koeritz <fred@gruntose.com>
Mon, 13 Nov 2017 04:20:19 +0000 (23:20 -0500)
scripts/core/common.alias
scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh [deleted file]
scripts/site_avenger/config/default.app
scripts/site_avenger/config/mapsdemo.app
scripts/site_avenger/revamp_cakelampvm.sh [new file with mode: 0644]
scripts/site_avenger/shared_site_mgr.sh
scripts/site_avenger/standup.sh
scripts/system/add_apache_site.sh
scripts/system/add_domain.sh

index cfb860d6461977393966611fc7875f57a2811da2..e15541526878d62d4f551cff3da238b860a05d0d 100644 (file)
@@ -105,7 +105,7 @@ define_yeti_alias snarf_linux_config="sudo -E PERLLIB=\$PERLLIB perl \$FEISTY_ME
 #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\""
 
 ##############
 
diff --git a/scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh b/scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh
deleted file mode 100644 (file)
index 2081b8f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/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
-
-##############
-
index 4fe8303cf9684d91ea468a5faefa431452908eaf..a7b9e90982241e8b1433fb38c6d3d29ae35e7f95 100644 (file)
@@ -1,6 +1,11 @@
 #!/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.
 
 ####
 
@@ -12,15 +17,6 @@ export CHECKOUT_DIR_NAME="avenger5"
 
 ####
 
-# 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}"
index ab89231bc78044f60680371a6211e6bad268534a..34fe6ce89fc9e9873ac88225fada9c2f3a228674 100644 (file)
@@ -3,8 +3,8 @@
 # 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"
+
diff --git a/scripts/site_avenger/revamp_cakelampvm.sh b/scripts/site_avenger/revamp_cakelampvm.sh
new file mode 100644 (file)
index 0000000..8e87c65
--- /dev/null
@@ -0,0 +1,42 @@
+#!/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
+
+##############
+
index 3c03ccbe6002aeb52223f952b8150b83f1bc471d..56e658e2d633201244ee88fdca034b8fa7680ccc 100644 (file)
@@ -16,6 +16,8 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 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.
@@ -36,6 +38,33 @@ function check_application_dir()
   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.
@@ -86,25 +115,6 @@ 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.
@@ -120,6 +130,8 @@ function test_app_folder()
     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.
@@ -178,12 +190,10 @@ var full_app_dir checkout_dirname repo_root repo_name
 
   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"
@@ -194,7 +204,6 @@ echo B
       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:"
@@ -205,22 +214,18 @@ echo C
     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.
index 96ec4cf3943434aad02388533f8d8a7b1a8dee9c..ae64d2b877b60d9daf7d86c1aa904f5678e24f3e 100644 (file)
@@ -67,7 +67,7 @@ else
   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"
@@ -79,8 +79,8 @@ 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" 
+#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.
@@ -89,6 +89,7 @@ powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME"
 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
+"
 
index 30ff1f50a7585056430b24733d12462aa12e6d27..57b5d519be85af004ec2f17bcae60036bc25a2c8 100644 (file)
@@ -66,6 +66,9 @@ function write_apache_config()
     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.
index e6b97fb6660fda2371481e1f05742872001f8ee1..80ebb2f37d0563e6d0d9b0d768d1e9b80a0797c3 100644 (file)
@@ -63,6 +63,10 @@ function write_new_domain_file()
 ${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.
@@ -86,6 +90,11 @@ zone \"${domain_name}\" in {
 ////////////////////////////////////////////////////////////////////////////
 
 " >> /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.
@@ -123,6 +132,9 @@ ${subdomain}.${containing_domain}.    IN A    ${IP_ADDRESS}
         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()