added new switchto macro, not quite right yet since can exit shell if doesn't find directory. some doc fixes in comments. turned off swap file unless special flag is present, since ssd drives do not want this.
polluted, the vessel breaks and the Buddha cannot be seen."
-- from "The Flower Ornament Scripture: A Translation of The Avatamsaka
Sutra", translated by Thomas Cleary, published by Shambhala Publications
+~
+Why is endeavor necessary? If we consider material progress, we see that
+research started by one person can always be continued by another. But this
+is not possible with spiritual progress. The realization we talk about in the
+Buddhadharma is something that has to be accomplished by the individual. No
+one else can do it for us. Of course, it would be wonderful if in the future
+we could attain realization through some sort of new injection or by means of
+a new generation of computers, without having to go through any difficulties.
+If we could be absolutely certain that such a time would come, we could simply
+lie back and wait to get enlightened. But I doubt that this will ever happen.
+It is better to make an effort. We have to develop endeavor.
+
+ 1.
+ Thus with patience I will strive with diligence.
+ For in such diligence enlightenment is found.
+ If no wind blows, then nothing stirs,
+ And neither is there merit without diligence.
+ -- H.H. the Fourteenth Dalai Lama, from "The Bodhisattva Guide: A Commentary
+ on The Way of the Bodhisattva", The Bodhisattva Guide was originally
+ published as For the Benefit of All Beings, also published by Shambhala
+ Publications
##############
+ # site avenger aliases
+ function switchto()
+ {
+ WORKDIR="$FEISTY_MEOW_SCRIPTS/site_avenger"
+ source "$FEISTY_MEOW_SCRIPTS/site_avenger/shared_site_mgr.sh"
+ switch_to "$1"
+ }
+
+ ##############
+
# NOTE: no more function definitions are allowed after this point.
function function_sentinel()
# Author: Kevin Wentworth
# Author: Chris Koeritz
-# This script "powers up" a cakephp site by running the database migrations,
-# cleaning out the ORM cache, and fixing file permissions.
+# This script "powers up" a cakephp site by checking out the code from the
+# git repository and installing the composer dependencies.
# This script is currently highly specific to site avenger.
# General Info:
# A git repository is expected to be provided, and we will get all the code
# for the web site from there. The repository is expected to have a single
# application "name" and one or more "themes". By convention, the name
-# and the theme are often the same.
+# and the theme are often the same, except the theme is capitalized.
# For example, let's say our app name is "turtle" and our theme name is "box".
# The repo is checked out to a folder called "~/apps/turtle".
# This script will want to use "turtle" as the app name.
##############
-# fix samba configuration for (ass-headed) default of read-only in user homes.
+# fix samba configuration for screwy default of read-only in user homes.
# why cripple a necessary feature by default?
sep
# was actually already in the file... too much subtlety can get one into trouble.
sed -i "0,/$pattern/{s/$pattern/$replacement/}" /etc/samba/smb.conf
test_or_die "patching samba configuration to enable write acccess on user home dirs"
+echo successfully patched the samba configuration to enable writes on user home directories.
+
# sweet, looks like that worked...
restart_samba
-echo successfully patched the samba configuration to enable writes on user home directories.
##############
sep
-echo "Checking existing swap partition configuration.
+# we will only add swap now if explicitly asked for it. this is to avoid creating
+# a swap file where the vm is running on an SSD, since that can use up the SSD's lifespan
+# too quickly.
+if [ ! -z "$ADD_SWAP" ]; then
+ echo "Checking existing swap partition configuration.
"
-# check for existing swap.
-free | grep -q "Swap:[[:blank:]]*[1-9][0-9]"
-if [ $? -ne 0 ]; then
- # no swap in current session, so add it.
- echo "Enabling ramdisk swap partition...
+ # check for existing swap.
+ free | grep -q "Swap:[[:blank:]]*[1-9][0-9]"
+ if [ $? -ne 0 ]; then
+ # no swap in current session, so add it.
+ echo "Enabling ramdisk swap partition...
"
- add_swap_mount
- echo "
+ add_swap_mount
+ echo "
Enabled ramdisk swap partition for current boot session."
-fi
+ fi
-# the above just gives this session a swap partition, but we want to have
-# the vm boot with one also.
+ # the above just gives this session a swap partition, but we want to have
+ # the vm boot with one also.
-# check if there is already swap mentioned in the root crontab. we will get root's
-# crontab below since this script has to run as sudo.
-crontab -l | grep -iq add_swap_mount
-if [ $? -ne 0 ]; then
- # no existing swap setup in crontab, so add it.
- echo "
+ # check if there is already swap mentioned in the root crontab. we will get root's
+ # crontab below since this script has to run as sudo.
+ crontab -l | grep -iq add_swap_mount
+ if [ $? -ne 0 ]; then
+ # no existing swap setup in crontab, so add it.
+ echo "
Adding a boot-time ramdisk swap partition...
"
- # need to do it carefully, since sed won't add lines to a null file. we thus
- # create a temporary file to do our work in and ignore sed as a tool for this.
- tmpfile="$(mktemp junk.XXXXXX)"
- crontab -l 2>/dev/null >"$tmpfile"
- echo "
+ # need to do it carefully, since sed won't add lines to a null file. we thus
+ # create a temporary file to do our work in and ignore sed as a tool for this.
+ tmpfile="$(mktemp junk.XXXXXX)"
+ crontab -l 2>/dev/null >"$tmpfile"
+ echo "
# need to explicitly set any variables we will use.
FEISTY_MEOW_APEX=${FEISTY_MEOW_APEX}
# add swap space to increase memory available.
@reboot bash $FEISTY_MEOW_APEX/scripts/system/add_swap_mount.sh
" >>"$tmpfile"
- # now install our new version of the crontab.
- crontab "$tmpfile"
- rm "$tmpfile"
+ # now install our new version of the crontab.
+ crontab "$tmpfile"
+ rm "$tmpfile"
- echo "
+ echo "
Added boot-time ramdisk swap partition to crontab for root."
+ fi
fi
##############
fix_site_perms "$combo"
}
+# Jumps to an application directory given the app name. If no app name is
+# given, it will show a menu to pick the app.
+function switch_to()
+{
+ # check for parameters.
+ app_dirname="$1"; shift
+
+ check_application_dir "$BASE_APPLICATION_PATH"
+
+ # find proper webroot where the site will be initialized.
+ if [ -z "$app_dirname" ]; then
+ # no dir was passed, so guess it.
+ find_app_folder "$BASE_APPLICATION_PATH"
+ else
+ test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
+ fi
+
+ # where we expect to find our checkout folder underneath.
+ full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
+
+ cd $full_app_dir/$CHECKOUT_DIR_NAME
+ pwd
+}