From: Chris Koeritz Date: Sun, 12 Nov 2017 07:32:21 +0000 (-0500) Subject: Merge branch 'dev' of feistymeow.org:feisty_meow into dev X-Git-Tag: 2.140.98^2~26 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=15c4171d9c405e62dbb29b1937861201473e6517;hp=f7c7a72565bbe30181e73bab205dcb125ed43df9;p=feisty_meow.git Merge branch 'dev' of feistymeow.org:feisty_meow into dev --- diff --git a/infobase/configuration/cron/aa_cron_defaults.crontab b/infobase/configuration/cron/aa_cron_defaults.crontab index 51a73ff4..c8ff3ebe 100644 --- a/infobase/configuration/cron/aa_cron_defaults.crontab +++ b/infobase/configuration/cron/aa_cron_defaults.crontab @@ -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: # diff --git a/infobase/feisty_inits/dot.bashrc-normal-user b/infobase/feisty_inits/dot.bashrc-normal-user index edc83b70..615970aa 100644 --- a/infobase/feisty_inits/dot.bashrc-normal-user +++ b/infobase/feisty_inits/dot.bashrc-normal-user @@ -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 diff --git a/infobase/feisty_inits/dot.bashrc-root b/infobase/feisty_inits/dot.bashrc-root index 1b1dd1e2..453a0fbd 100644 --- a/infobase/feisty_inits/dot.bashrc-root +++ b/infobase/feisty_inits/dot.bashrc-root @@ -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" # the "fredme" macro enables the feisty_meow environment. alias fredme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"' diff --git a/scripts/core/common.alias b/scripts/core/common.alias index 9d4049e5..af3378bf 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -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' @@ -87,10 +101,10 @@ 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="bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/standup.sh\"" +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="bash \"$FEISTY_MEOW_SCRIPTS/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh" +define_yeti_alias revamp_web_permissions="sudo bash \"$FEISTY_MEOW_SCRIPTS/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh" ############## @@ -118,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. diff --git a/scripts/core/launch_feisty_meow.sh b/scripts/core/launch_feisty_meow.sh index 241e2a0f..a9db25b4 100644 --- a/scripts/core/launch_feisty_meow.sh +++ b/scripts/core/launch_feisty_meow.sh @@ -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. diff --git a/scripts/rev_control/rfluffer.sh b/scripts/rev_control/rfluffer.sh deleted file mode 100644 index b5de908e..00000000 --- a/scripts/rev_control/rfluffer.sh +++ /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 index 00000000..5032bc12 --- /dev/null +++ b/scripts/rev_control/rpuffer.sh @@ -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" + diff --git a/scripts/site_avenger/shared_site_mgr.sh b/scripts/site_avenger/shared_site_mgr.sh index 580b896d..b30ca82d 100644 --- a/scripts/site_avenger/shared_site_mgr.sh +++ b/scripts/site_avenger/shared_site_mgr.sh @@ -11,11 +11,14 @@ 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. diff --git a/scripts/site_avenger/standup.sh b/scripts/site_avenger/standup.sh index ee4a0026..47e1aeec 100644 --- a/scripts/site_avenger/standup.sh +++ b/scripts/site_avenger/standup.sh @@ -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,31 +41,41 @@ overridden by setting the SITE_MANAGEMENT_CONFIG_FILE environment variable." # check for parameters. app_dirname="$1"; shift +if [ "$app_dirname" == "-help" -o "$app_dirname" == "--help" ]; then + print_instructions +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 -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 -fi - sep check_application_dir "$APPLICATION_DIR" +# find proper webroot where the site will be initialized. +if [ -z "$app_dirname" ]; then + # no dir was passed, so guess it. + find_app_folder "$APPLICATION_DIR" +else + test_app_folder "$APPLICATION_DIR" "$app_dirname" +fi + add_domain "$DOMAIN_NAME" test_or_die "Setting up domain: $DOMAIN_NAME" +sep + add_apache_site "$APPLICATION_NAME" "$DOMAIN_NAME" test_or_die "Setting up apache site for: $APPLICATION_NAME" +sep + powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME" sep diff --git a/scripts/system/add_apache_site.sh b/scripts/system/add_apache_site.sh index e99f371a..6be31c8c 100644 --- a/scripts/system/add_apache_site.sh +++ b/scripts/system/add_apache_site.sh @@ -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:" diff --git a/scripts/system/add_domain.sh b/scripts/system/add_domain.sh index 0dabaf2e..e0a6fb48 100644 --- a/scripts/system/add_domain.sh +++ b/scripts/system/add_domain.sh @@ -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 "