for the auto-location stuff, we're now using the more self-descriptive name of THISDIR for where the script started up in.
ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && /bin/pwd )"
# another slightly tighter version:
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
# backs up a trac repository into a tar.gz file.
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
trac_path="$1"; shift
archive_path="$1"; shift
# call our arbitrary backer upper, since this is a simple single directory case.
-bash $WORKDIR/backup_arbitrary.sh "$trac_path" "$archive_path" "trac_bkup"
+bash $THISDIR/backup_arbitrary.sh "$trac_path" "$archive_path" "trac_bkup"
# this script adds the feisty inits code to .bashrc, if we think it has not yet been added.
# auto-locate the feisty meow scripts, since they supposedly are not enabled yet.
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
# normalize the path we want to cobble together.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
echo calculated apex as $FEISTY_MEOW_APEX
# site avenger aliases
function switchto()
{
- WORKDIR="$FEISTY_MEOW_SCRIPTS/site_avenger"
+ THISDIR="$FEISTY_MEOW_SCRIPTS/site_avenger"
source "$FEISTY_MEOW_SCRIPTS/site_avenger/shared_site_mgr.sh"
switch_to "$1"
}
##############
# this script cannot handle figuring out where it lives, so approaches that
-# get the WORKDIR will fail. this is a consequence of this always being used
+# get the THISDIR will fail. this is a consequence of this always being used
# in bash's 'source' directive, which does not pass the script name as
# argument 0. instead, we just check for the bad condition of a malconfigured
# script system and try to repair it.
fi
# fix some permissions for important security considerations.
- harsh_perm $HOME/.ssh
+ if [ -d $HOME/.ssh ]; then
+ harsh_perm $HOME/.ssh
+ fi
+
+#hmmm: consider adding feisty meow apex to the dirname list below.
-#hmmm: consider adding feisty meow apex to the list below.
# iterate across the list of dirs we want cooluser to own and change their ownership.
- for dirname in $HOME $DEFAULT_FEISTYMEOW_ORG_DIR /usr/local/${cooluser} /home/games $arch_addin; do
+ for dirname in $HOME \
+ $DEFAULT_FEISTYMEOW_ORG_DIR \
+ /usr/local/${cooluser} \
+ /home/games \
+ $arch_addin; do
if [ -d "$dirname" ]; then
echo "revising ownership on '$dirname'"
sudo chown -R ${cooluser}:${cooluser} "$dirname"
fi
done
- # special case for archives directory.
+ # special case for archives directory in stuffing.
if [ -d /z/stuffing -o -L /z/stuffing ]; then
- sudo chown ${cooluser}:${cooluser} /z
+ sudo chown ${cooluser}:${cooluser} /z/
test_or_die "chowning /z for ${cooluser}"
sudo chmod g+rx,o+rx /z
test_or_die "chmodding /z/ for ${cooluser}"
- sudo chown ${cooluser}:${cooluser} /z/stuffing
+ sudo chown ${cooluser}:${cooluser} /z/stuffing/
test_or_die "chowning /z/stuffing for ${cooluser}"
sudo chmod g+rx,o-rwx /z/stuffing
test_or_die "chmodding /z/stuffing for ${cooluser}"
pushd /z/stuffing &>/dev/null
if [ -d archives -o -L archives ]; then
- sudo chown ${cooluser}:${cooluser} archives
+ sudo chown ${cooluser}:${cooluser} archives/
test_or_die "chowning /z/stuffing/archives for ${cooluser}"
sudo chmod -R g+rwx archives
test_or_die "chmodding /z/stuffing/archives for ${cooluser}"
popd &>/dev/null
fi
- # make the logs readable by normal humans.
+ # make the log files readable by normal humans.
sudo bash $FEISTY_MEOW_SCRIPTS/security/normal_perm.sh /var/log
test_or_die "setting normal perms on /var/log"
}
# than when it's just being sourced.
# this runs the cool permission applier on the current user.
-if [[ $0 =~ .*reapply_cool_permissions\.sh.* ]]; then
+if [[ $0 =~ .*cool_permissionator\.sh.* ]]; then
+echo A
THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )"
+echo B
+ export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
+echo B.2
source "$THISDIR/../core/launch_feisty_meow.sh"
test_or_die "sourcing the feisty meow launcher"
+echo C
reapply_cool_permissions $(logname)
test_or_die "reapplying cool permissions on $(logname)"
+echo D
fi
# Author: Chris Koeritz
# license gnu gpl v3
-export WORKDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
if [[ ! "$0" =~ ^/.* ]]; then
# re-run the script with an absolute path if it didn't start out that way; otherwise,
# shunit is not happy with finding the script.
- exec "$WORKDIR/$(basename $0)" $*
+ exec "$THISDIR/$(basename $0)" $*
fi
-cd $WORKDIR
+cd $THISDIR
oneTimeSetUp()
{
# updates just the site avenger core portion of an app.
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
############################
# check for parameters.
app_dirname="$1"; shift
-source "$WORKDIR/shared_site_mgr.sh"
+source "$THISDIR/shared_site_mgr.sh"
sep
# It will have to be told the theme name, but will assume it's 'Turtle' to
# 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 )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
print_instructions
fi
-source "$WORKDIR/shared_site_mgr.sh"
+source "$THISDIR/shared_site_mgr.sh"
sep
##############
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
export NO_HELLO=right
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
##############
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
export NO_HELLO=right
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
# This contains a bunch of reusable functions that help out in managing websites.
-# This script is sourced, and relies on the value of WORKDIR, which should
+# This script is sourced, and relies on the value of THISDIR, which should
# point at the directory where the site management scripts are stored,
# especially this one.
# 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"
+ SITE_MANAGEMENT_CONFIG_FILE="$THISDIR/config/default.app"
echo "$(date_stringer): Site management config file was not set. Using default:" >> "$SSM_LOG_FILE"
echo "$(date_stringer): $SITE_MANAGEMENT_CONFIG_FILE" >> "$SSM_LOG_FILE"
fi
{
local app_dirname="$1"; shift
- local configfile="$WORKDIR/config/${app_dirname}.app"
+ local configfile="$THISDIR/config/${app_dirname}.app"
echo "$(date_stringer): config file guessed?: $configfile" >> "$SSM_LOG_FILE"
if [ ! -f "$configfile" ]; then
# this is not a good config file. we can't auto-guess the config.
# checks the chosen site into the online git repository.
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
############################
app_dirname="$1"; shift
repo_name="$1"; shift
-source "$WORKDIR/shared_site_mgr.sh"
+source "$THISDIR/shared_site_mgr.sh"
sep
# updates a site avenger app.
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
############################
app_dirname="$1"; shift
repo_name="$1"; shift
-source "$WORKDIR/shared_site_mgr.sh"
+source "$THISDIR/shared_site_mgr.sh"
sep
# management scripts. So far, the scripts rely on at least php. The support
# 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 )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
# through to ask for access.
sudo bash -c 'echo sudo permissions acquired.'
-source "$WORKDIR/shared_site_mgr.sh"
+source "$THISDIR/shared_site_mgr.sh"
sep
#
# Author: Chris Koeritz
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
# through to ask for access.
sudo bash -c 'echo sudo permissions acquired.'
-source "$WORKDIR/shared_site_mgr.sh"
+source "$THISDIR/shared_site_mgr.sh"
sep
# creates a new apache website for a specified domain.
# 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.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"
#
# Author: Chris Koeritz
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"
#!/bin/bash
# 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.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
if [[ $EUID != 0 ]]; then
# uninstalls the apache website for a specified domain.
# 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.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"
#
# Author: Chris Koeritz
-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
+export THISDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
+export FEISTY_MEOW_APEX="$( \cd "$THISDIR/../.." && \pwd )"
source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"
source "$FEISTY_MEOW_SCRIPTS/system/common_sysadmin.sh"