fi
echo "Synchronizing $source into $dest."
synch_files "$source" "$dest"
- test_or_continue "synching $source to $dest"
+ continue_on_error "synching $source to $dest"
}
##############
# now saddle up the backup.
#NO LONGER USING MOUNT: mount /z/backup/
-#NO LONGER USING MOUNT: test_or_die "mounting backup folder"
+#NO LONGER USING MOUNT: exit_on_error "mounting backup folder"
# we should always be synching to an existing set in there. make sure they exist.
# for the first ever backup, this is not a good check...
#test -d /z/backup/etc -a -d /z/backup/home
-#test_or_die "testing presence of prior backup"
+#exit_on_error "testing presence of prior backup"
##############
##############
#NO LONGER USING MOUNT: umount /z/backup/
-#NO LONGER USING MOUNT: test_or_die "unmounting backup folder"
+#NO LONGER USING MOUNT: exit_on_error "unmounting backup folder"
echo making a simple starting log file for container...
if [ ! -d "$GFFS_LOGS" ]; then
mkdir -p "$GFFS_LOGS"
- test_or_die Making GFFS logs directory.
+ exit_on_error Making GFFS logs directory.
fi
echo building the code freshly, although not with a clean first...
build_gffs
-test_or_die Building GFFS source code.
+exit_on_error Building GFFS source code.
echo starting container now and spooling its log file...
(bash $GFFS_TOOLKIT_ROOT/library/maybe_restart_container.sh &>$TMP/main_container_restarting.log & )
# checks the result of the last command that was run, and if that failed,
# then this complains and exits from bash. the function parameters are
# used as the message to print as a complaint.
- function test_or_die()
+ function exit_on_error()
{
if [ $? -ne 0 ]; then
echo -e "\n\naction failed: $*\n\n*** Exiting script..."
fi
}
- # like test_or_die, but will keep going after complaining.
- function test_or_continue()
+ # like exit_on_error, but will keep going after complaining.
+ function continue_on_error()
{
if [ $? -ne 0 ]; then
echo -e "\n\nerror occurred: $*\n\n=> Continuing script..."
#hmmm: better yet actually, just don't complain on freaking cygwin, since that's where this happens
chown -R "$(logname):$(logname)" \
"$FEISTY_MEOW_LOADING_DOCK"/* "$FEISTY_MEOW_GENERATED_STORE"/* 2>/dev/null
- test_or_continue "chowning to $(logname) didn't happen."
+ continue_on_error "chowning to $(logname) didn't happen."
regenerate >/dev/null
pushd "$FEISTY_MEOW_LOADING_DOCK/custom" &>/dev/null
if [ ${#incongruous_files} -ge 2 ]; then
echo "cleaning unknown older overrides..."
perl "$FEISTY_MEOW_SCRIPTS/files/safedel.pl" $incongruous_files
- test_or_continue "running safedel. $fail_message"
+ continue_on_error "running safedel. $fail_message"
echo
fi
popd &>/dev/null
echo "copying custom overrides for $custom_user"
mkdir -p "$FEISTY_MEOW_LOADING_DOCK/custom" 2>/dev/null
perl "$FEISTY_MEOW_SCRIPTS/text/cpdiff.pl" "$FEISTY_MEOW_SCRIPTS/customize/$custom_user" "$FEISTY_MEOW_LOADING_DOCK/custom"
- test_or_continue "running cpdiff. $fail_message"
+ continue_on_error "running cpdiff. $fail_message"
if [ -d "$FEISTY_MEOW_SCRIPTS/customize/$custom_user/scripts" ]; then
echo "copying custom scripts for $custom_user"
rsync -avz "$FEISTY_MEOW_SCRIPTS/customize/$custom_user/scripts" "$FEISTY_MEOW_LOADING_DOCK/custom/" &>/dev/null
- test_or_continue "copying customization scripts"
+ continue_on_error "copying customization scripts"
#hmmm: could save output to show if an error occurs.
fi
echo
# prevent permission foul-ups, again.
chown -R "$(logname):$(logname)" \
"$FEISTY_MEOW_LOADING_DOCK" "$FEISTY_MEOW_GENERATED_STORE" 2>/dev/null
- test_or_continue "chowning to $(logname) didn't happen."
+ continue_on_error "chowning to $(logname) didn't happen."
restore_terminal_title
}
if [ -d "$src" ]; then
ln -s "$src" "$target"
- test_or_die "Creating symlink from '$src' to '$target'"
+ exit_on_error "Creating symlink from '$src' to '$target'"
fi
echo "Created symlink from '$src' to '$target'."
}
temp_out="$TMP/$file.view"
cat "$file" | python -m json.tool > "$temp_out"
show_list+=($temp_out)
- test_or_continue "pretty printing '$file'"
+ continue_on_error "pretty printing '$file'"
done
filedump "${show_list[@]}"
rm "${show_list[@]}"
# make a backup first, oy.
\cp -f "$filename" "/tmp/$(basename ${filename}).bkup-${RANDOM}"
- test_or_die "backing up file: $filename"
+ exit_on_error "backing up file: $filename"
# make a temp file to write to before we move file into place in bind.
local new_version="/tmp/$(basename ${filename}).bkup-${RANDOM}"
\rm -f "$new_version"
- test_or_die "cleaning out new version of file from: $new_version"
+ exit_on_error "cleaning out new version of file from: $new_version"
local line
local skip_count=0
if [ ! -z "$found_any" ]; then
# put the file back into place under the original name.
\mv "$new_version" "$filename"
- test_or_die "moving the new version into place in: $filename"
+ exit_on_error "moving the new version into place in: $filename"
else
# cannot always be considered an error, but we can at least gripe.
echo "Did not find any matches for seeker '$seeker' in file: $filename"
echo running tests on set_var_if_undefined.
flagrant=petunia
set_var_if_undefined flagrant forknordle
- test_or_die "testing if defined variable would be whacked"
+ exit_on_error "testing if defined variable would be whacked"
if [ $flagrant != petunia ]; then
echo set_var_if_undefined failed to leave the test variable alone
exit 1
# than when it's just being sourced.
if [[ $0 =~ .*redeveloper\.sh.* ]]; then
source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
- test_or_die "sourcing the feisty meow environment"
+ exit_on_error "sourcing the feisty meow environment"
source "$FEISTY_MEOW_SCRIPTS/security/cool_permissionator.sh"
- test_or_die "sourcing the permission script"
+ exit_on_error "sourcing the permission script"
do_redeveloper
- test_or_die "redevelopering process"
+ exit_on_error "redevelopering process"
fi
source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
cp $HOME/.thunderbird/oqv30zg4.default/ImapMail/zooty.koeritz.com/msgFilterRules.dat $CLOUD_BASE/magic_cabinet/mail_filters/zooty_serene_hamstertronic_$(date_stringer).filters
-test_or_die "copying feistymeow.org filters"
+exit_on_error "copying feistymeow.org filters"
cp $HOME/.thunderbird/oqv30zg4.default/ImapMail/mail.eservices.virginia.edu/msgFilterRules.dat $CLOUD_BASE/magic_cabinet/mail_filters/uva_email_$(date_stringer).filters
-test_or_die "copying UVa filters"
+exit_on_error "copying UVa filters"
return
fi
ln -s "$name" "$new_name"
- test_or_die "creating link for $dir/$new_name from $dir/$name"
+ exit_on_error "creating link for $dir/$new_name from $dir/$name"
echo "Created link $dir/$new_name from $dir/$name"
popd &>/dev/null
}
if [ ! -d "$SPOOLING_OUTPUT_DIR" ]; then
mkdir -p "$SPOOLING_OUTPUT_DIR"
- test_or_die Creating spooling output directory.
+ exit_on_error Creating spooling output directory.
fi
# copies the files for a particular game out to a spooling folder.
# than when it's just being sourced.
if [[ $0 =~ .*refred\.sh.* ]]; then
source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
- test_or_die "sourcing the feisty meow environment"
+ exit_on_error "sourcing the feisty meow environment"
source "$FEISTY_MEOW_SCRIPTS/security/cool_permissionator.sh"
- test_or_die "sourcing the permission script"
+ exit_on_error "sourcing the permission script"
do_refred
- test_or_die "refredding process"
+ exit_on_error "refredding process"
fi
fi
checkin_list $FULL_LIST
-test_or_die "checking in list: $FULL_LIST"
+exit_on_error "checking in list: $FULL_LIST"
##############
prune_dir="$(pwd)"
fi
pushd "$prune_dir" &>/dev/null
-test_or_die "changing to directory: $prune_dir"
+exit_on_error "changing to directory: $prune_dir"
echo "cleaning git repo in directory $(pwd)"
git fsck --full
-test_or_die "git fsck"
+exit_on_error "git fsck"
git gc --prune=today --aggressive
-test_or_die "git gc"
+exit_on_error "git gc"
git repack
-test_or_die "git repack"
+exit_on_error "git repack"
popd &>/dev/null
fi
pushd "$dir" &>/dev/null
-test_or_die "changing to directory: $dir"
+exit_on_error "changing to directory: $dir"
tempfile=$(generate_rev_ctrl_filelist)
popd &>/dev/null
perform_revctrl_action_on_file "$tempfile" do_diff
-test_or_die "performing revision control action do_diff on: $tempfile"
+exit_on_error "performing revision control action do_diff on: $tempfile"
fi
new_name="$TMP/zz_$(basename $0)"
\cp -f "$0" "$new_name"
- test_or_die "failed to copy this script up to the TMP directory. exploit attempted?"
+ exit_on_error "failed to copy this script up to the TMP directory. exploit attempted?"
pushd "$TMP" &>/dev/null
- test_or_die "changing to TMP directory: $TMP"
+ exit_on_error "changing to TMP directory: $TMP"
chmod a+x "$new_name"
- test_or_die "chmodding of file: $new_name"
+ exit_on_error "chmodding of file: $new_name"
exec "$new_name"
- test_or_die "execing cloned getemscript"
+ exit_on_error "execing cloned getemscript"
popd &>/dev/null
fi
export TMPO_CHK=$TMP/zz_chk.log
rm -f "$TMPO_CHK"
-test_or_die "removing file: $TMPO_CHK"
+exit_on_error "removing file: $TMPO_CHK"
echo "getting repositories at: $(date)"
echo
FULL_LIST+="c:/ d:/ e:/"
fi
checkout_list $FULL_LIST 2>&1 | tee -a "$TMPO_CHK"
-test_or_die "checking out list: $FULL_LIST"
+exit_on_error "checking out list: $FULL_LIST"
##############
fi
puff_out_list $FULL_LIST
-test_or_die "puffing out list: $FULL_LIST"
+exit_on_error "puffing out list: $FULL_LIST"
##############
fi
pushd "$dir" &>/dev/null
-test_or_die "changing to directory: $dir"
+exit_on_error "changing to directory: $dir"
tempfile=$(generate_rev_ctrl_filelist)
-test_or_die "generating revision control file list"
+exit_on_error "generating revision control file list"
perform_revctrl_action_on_file "$tempfile" do_careful_git_update
-test_or_die "doing a careful update on: $tempfile"
+exit_on_error "doing a careful update on: $tempfile"
# seems to be needed to cause a merge to be resolved.
git pull downstream master
# -m "unfortunate merge"
-test_or_die "running the git pull downstream master"
+exit_on_error "running the git pull downstream master"
# send our little boat down the stream to the dependent repository.
git push --tags downstream master
-test_or_die "running the git push downstream master"
+exit_on_error "running the git push downstream master"
popd &>/dev/null
fi
pushd "$dir" &>/dev/null
-test_or_die "changing to directory: $dir"
+exit_on_error "changing to directory: $dir"
tempfile=$(generate_rev_ctrl_filelist)
-test_or_die "generating revision control file list"
+exit_on_error "generating revision control file list"
popd &>/dev/null
perform_revctrl_action_on_file "$tempfile" do_checkin
-test_or_die "doing a check-in on: $tempfile"
+exit_on_error "doing a check-in on: $tempfile"
fi
pushd "$dir" &>/dev/null
-test_or_die "changing directory to: $dir"
+exit_on_error "changing directory to: $dir"
tempfile=$(generate_rev_ctrl_filelist)
-test_or_die "generating revision control file list"
+exit_on_error "generating revision control file list"
popd &>/dev/null
perform_revctrl_action_on_file "$tempfile" do_report_new
-test_or_die "running revision control report"
+exit_on_error "running revision control report"
fi
svn resolve --accept=working "$filename"
-test_or_die "resolving tree conflict by accepting the working directory as the right one"
+exit_on_error "resolving tree conflict by accepting the working directory as the right one"
fi
pushd "$dir" &>/dev/null
-test_or_die "changing to directory: $dir"
+exit_on_error "changing to directory: $dir"
tempfile=$(generate_rev_ctrl_filelist)
-test_or_die "generating revision control file list"
+exit_on_error "generating revision control file list"
popd &>/dev/null
perform_revctrl_action_on_file "$tempfile" do_update
-test_or_die "running revision control update"
+exit_on_error "running revision control update"
fi
pushd "$dir" &>/dev/null
-test_or_die "changing to directory: $dir"
+exit_on_error "changing to directory: $dir"
tempfile=$(generate_rev_ctrl_filelist)
-test_or_die "generating revision control file list"
+exit_on_error "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"
+exit_on_error "puffing out repository at: $tempfile"
local blatt="echo -n checking in '$nicedir'... "
do_update "$directory"
- test_or_die "repository update--this should be fixed before check-in."
+ exit_on_error "repository update--this should be fixed before check-in."
pushd "$directory" &>/dev/null
if [ -f ".no-checkin" ]; then
if test_writeable "CVS"; then
$blatt
cvs ci .
- test_or_die "cvs checkin"
+ exit_on_error "cvs checkin"
fi
elif [ -d ".svn" ]; then
if test_writeable ".svn"; then
$blatt
svn ci .
- test_or_die "svn checkin"
+ exit_on_error "svn checkin"
fi
elif [ -d ".git" ]; then
if test_writeable ".git"; then
# put all changed and new files in the commit. not to everyone's liking.
git add --all . | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "git add all new files"
+ exit_on_error "git add all new files"
# see if there are any changes in the local repository.
if ! git diff-index --quiet HEAD --; then
#hmmm: begins to look like, you guessed it, a reusable bit that all commit actions could enjoy.
git commit .
retval=$?
- test_or_continue "git commit"
+ continue_on_error "git commit"
if [ $retval -ne 0 ]; then
echo -e -n "Commit failed or was aborted:\nShould we continue with other check-ins? [y/N] "
local line
# upload any changes to the upstream repo so others can see them.
git push --tags origin "$(my_branch_name)" 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "git push"
+ exit_on_error "git push"
fi
else
# only update if we see a repository living there.
if [ -d ".svn" ]; then
svn diff .
- test_or_die "subversion diff"
+ exit_on_error "subversion diff"
elif [ -d ".git" ]; then
git diff
- test_or_die "git diff"
+ exit_on_error "git diff"
elif [ -d "CVS" ]; then
cvs diff .
- test_or_die "cvs diff"
+ exit_on_error "cvs diff"
fi
popd &>/dev/null
elif [ -d ".svn" ]; then
# this action so far only makes sense and is needed for svn.
bash $FEISTY_MEOW_SCRIPTS/rev_control/svnapply.sh \? echo
- test_or_die "svn diff"
+ exit_on_error "svn diff"
elif [ -d ".git" ]; then
git status -u
- test_or_die "git status -u"
+ exit_on_error "git status -u"
fi
popd &>/dev/null
# yep, this path is absolute. just handle it directly.
if [ ! -d "$outer" ]; then continue; fi
do_checkin "$outer"
- test_or_die "running check-in (absolute) on path: $outer"
+ exit_on_error "running check-in (absolute) on path: $outer"
sep 28
else
for inner in $list; do
local path="$inner/$outer"
if [ ! -d "$path" ]; then continue; fi
do_checkin "$path"
- test_or_die "running check-in (relative) on path: $path"
+ exit_on_error "running check-in (relative) on path: $path"
sep 28
done
fi
# yep, this path is absolute. just handle it directly.
if [ ! -d "$outer" ]; then continue; fi
do_careful_git_update "$outer"
- test_or_die "running puff-out (absolute) on path: $outer"
+ exit_on_error "running puff-out (absolute) on path: $outer"
sep 28
else
for inner in $list; do
local path="$inner/$outer"
if [ ! -d "$path" ]; then continue; fi
do_careful_git_update "$path"
- test_or_die "running puff-out (relative) on path: $path"
+ exit_on_error "running puff-out (relative) on path: $path"
sep 28
done
fi
{
local directory="$1"; shift
pushd "$directory" &>/dev/null
- test_or_die "changing to directory: $directory"
+ exit_on_error "changing to directory: $directory"
if [ ! -d ".git" ]; then
# first update all our remote branches to their current state from the repos.
git remote update | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "git remote update"
+ exit_on_error "git remote update"
show_branch_conditionally "$this_branch"
# echo "synchronizing remote branch: $bran"
git checkout "$bran" | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "git switching checkout to remote branch: $bran"
+ exit_on_error "git switching checkout to remote branch: $bran"
show_branch_conditionally "$this_branch"
# without any changes in them. --no-ff
promote_pipe_return 0
fi
- test_or_die "git pull of remote branch: $bran"
+ exit_on_error "git pull of remote branch: $bran"
done
# now switch back to our branch.
git checkout "$this_branch" | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "git checking out our current branch: $this_branch"
+ exit_on_error "git checking out our current branch: $this_branch"
# now pull down any changes in our own origin in the repo, to stay in synch
# with any changes from others.
#it does an --all, but is that effective or different? should we be doing that in above loop?
# --no-ff
promote_pipe_return 0
- test_or_die "git pulling all upstream"
+ exit_on_error "git pulling all upstream"
popd &>/dev/null
}
$blatt
cvs update . | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "cvs update"
+ exit_on_error "cvs update"
fi
elif [ -d ".svn" ]; then
if test_writeable ".svn"; then
$blatt
svn update . | $TO_SPLITTER
promote_pipe_return 0
- test_or_die "svn update"
+ exit_on_error "svn update"
fi
elif [ -d ".git" ]; then
if test_writeable ".git"; then
git pull --tags $PULL_ADDITION 2>&1 | grep -v "X11 forwarding request failed" | $TO_SPLITTER
#ordinary pulls should be allowed to do fast forward: --no-ff
promote_pipe_return 0
- test_or_die "git pull of origin"
+ exit_on_error "git pull of origin"
fi
else
# this is not an error necessarily; we'll just pretend they planned this.
# yep, this path is absolute. just handle it directly.
if [ ! -d "$outer" ]; then continue; fi
do_update $outer
- test_or_die "running update on: $path"
+ exit_on_error "running update on: $path"
sep 28
else
for inner in $list; do
local path="$inner/$outer"
if [ ! -d "$path" ]; then continue; fi
do_update $path
- test_or_die "running update on: $path"
+ exit_on_error "running update on: $path"
sep 28
done
fi
echo "[$(pwd)]"
# pass the current directory plus the remaining parameters from function invocation.
$action .
- test_or_die "performing action $action on: $(pwd)"
+ exit_on_error "performing action $action on: $(pwd)"
sep 28
popd &>/dev/null
done 3<"$tempfile"
# 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"
+ exit_on_error "making directory: $DEFAULT_FEISTYMEOW_ORG_DIR"
fi
# fix some permissions for important security considerations.
if [ -d "$dirname" ]; then
echo "revising ownership on '$dirname'"
sudo chown -R ${cooluser}:${cooluser} "$dirname"
- test_or_die "chowning for ${cooluser}: $dirname"
+ exit_on_error "chowning for ${cooluser}: $dirname"
fi
done
# special case for archives directory in stuffing.
if [ -d /z/stuffing -o -L /z/stuffing ]; then
sudo chown ${cooluser}:${cooluser} /z/
- test_or_die "chowning /z for ${cooluser}"
+ exit_on_error "chowning /z for ${cooluser}"
sudo chmod g+rx,o+rx /z
- test_or_die "chmodding /z/ for ${cooluser}"
+ exit_on_error "chmodding /z/ for ${cooluser}"
sudo chown ${cooluser}:${cooluser} /z/stuffing/
- test_or_die "chowning /z/stuffing for ${cooluser}"
+ exit_on_error "chowning /z/stuffing for ${cooluser}"
sudo chmod g+rx,o-rwx /z/stuffing
- test_or_die "chmodding /z/stuffing for ${cooluser}"
+ exit_on_error "chmodding /z/stuffing for ${cooluser}"
pushd /z/stuffing &>/dev/null
if [ -d archives -o -L archives ]; then
sudo chown ${cooluser}:${cooluser} archives/
- test_or_die "chowning /z/stuffing/archives for ${cooluser}"
+ exit_on_error "chowning /z/stuffing/archives for ${cooluser}"
sudo chmod -R g+rwx archives
- test_or_die "chmodding /z/stuffing/archives for ${cooluser}"
+ exit_on_error "chmodding /z/stuffing/archives for ${cooluser}"
fi
popd &>/dev/null
fi
# 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"
+ exit_on_error "setting normal perms on /var/log"
}
# this block should execute when the script is actually run, rather
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"
+ exit_on_error "sourcing the feisty meow launcher"
echo C
reapply_cool_permissions $(logname)
- test_or_die "reapplying cool permissions on $(logname)"
+ exit_on_error "reapplying cool permissions on $(logname)"
echo D
fi
fi
echo "$passwd" > "$passfile"
- test_or_die "writing password into the file $passfile"
+ exit_on_error "writing password into the file $passfile"
chown root:root "$passfile"
- test_or_die "chowning the password file to root ownership for: $passfile"
+ exit_on_error "chowning the password file to root ownership for: $passfile"
chmod 600 "$passfile"
- test_or_die "restricting permissions on password file for: $passfile"
+ exit_on_error "restricting permissions on password file for: $passfile"
}
# reads a password from the console, without echoing the letters when they
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
-test_or_die "finding and testing app folder"
+exit_on_error "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
# simplistic approach here; just go to the folder and pull the changes.
pushd "$full_app_dir" &>/dev/null
-test_or_die "Changing to app path '$full_app_dir'"
+exit_on_error "Changing to app path '$full_app_dir'"
dir="avenger5/vendor/siteavenger/avcore"
if [ ! -d $dir ]; then
pushd "$dir" &>/dev/null
git pull
- test_or_die "Pulling git repo for avcore under '$full_app_dir'"
+ exit_on_error "Pulling git repo for avcore under '$full_app_dir'"
echo "Finished updating the avcore portion of site in ${app_dirname}."
#
# change over to fred folder
pushd /home/fred
-test_or_die "changing dir to fred's home; what have you done with fred?"
+exit_on_error "changing dir to fred's home; what have you done with fred?"
pushd apps/mapsdemo/avenger5
-test_or_die "changing dir to mapsdemo app"
+exit_on_error "changing dir to mapsdemo app"
rpuffer . &>/dev/null
if [ $? -ne 0 ]; then
# it seems our old files are still conflicting this.
if [ -f config/config_google.php ]; then
\rm -f config/config_google.php
- test_or_die "removing old config for google"
+ exit_on_error "removing old config for google"
fi
if [ -f config/app.php ]; then
\rm -f config/app.php
- test_or_die "removing old config for app"
+ exit_on_error "removing old config for app"
fi
git reset --hard HEAD
- test_or_die "resetting git's hard head"
+ exit_on_error "resetting git's hard head"
rpuffer .
#hmmm: use output saver thing when that exists.
- test_or_die "puffing out mapsdemo app after inadequate corrective action was taken"
+ exit_on_error "puffing out mapsdemo app after inadequate corrective action was taken"
fi
popd
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
-test_or_die "finding and testing app folder"
+exit_on_error "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
# 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"
+exit_on_error "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"
+exit_on_error "Installing site dependencies with composer"
# set up the symbolic links needed to achieve siteliness.
sep
echo "Regenerating feisty meow loading dock."
regenerate
-test_or_die "regenerating feisty meow configuration"
+exit_on_error "regenerating feisty meow configuration"
chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
-test_or_die "fix after reconfigured as sudo"
+exit_on_error "fix after reconfigured as sudo"
##############
create user if not exists 'lampcake'@'%' IDENTIFIED BY 'bakecamp';
grant all privileges on *.* TO 'lampcake'@'%' with grant option;
EOF
-test_or_die "configuring root, wampcake and lampcake users on mysql"
+exit_on_error "configuring root, wampcake and lampcake users on mysql"
##############
# fix up the main web storage.
chown -R www-data:www-data /var/www
-test_or_die "chown www-data"
+exit_on_error "chown www-data"
group_perm /var/www
-test_or_die "group_perm www-data"
+exit_on_error "group_perm www-data"
##############
# set up access on some important folders for the developer user.
chown -R developer:developer /home/developer /home/developer/.[a-zA-Z0-9]*
-test_or_die "chown developer home"
+exit_on_error "chown developer home"
harsh_perm /home/developer/.ssh
-test_or_die "harsh_perm setting on developer .ssh"
+exit_on_error "harsh_perm setting on developer .ssh"
##############
# give the developer control over the apache and bind config files, as well
# as giving the user ownership of the local feisty meow repository.
chown -R developer:developer /etc/apache2 /etc/bind
-test_or_die "chown apache2 and bind to developer"
+exit_on_error "chown apache2 and bind to developer"
group_perm /etc/apache2 /etc/bind
-test_or_die "group perms on apache2 and bind"
+exit_on_error "group perms on apache2 and bind"
chown -R developer:developer /opt/feistymeow.org
-test_or_die "chown feisty meow to developer"
+exit_on_error "chown feisty meow to developer"
group_perm /opt/feistymeow.org
-test_or_die "group perms on feisty meow"
+exit_on_error "group perms on feisty meow"
##############
# fix perms for fred user.
chown -R fred:fred /home/fred /home/archives/stuffing /home/fred/.[a-zA-Z0-9]*
-test_or_die "chown fred home"
+exit_on_error "chown fred home"
group_perm $HOME/apps
-test_or_die "group perms on fred's apps"
+exit_on_error "group perms on fred's apps"
harsh_perm /home/fred/.ssh
-test_or_die "harsh_perm setting on fred .ssh"
+exit_on_error "harsh_perm setting on fred .ssh"
group_perm /home/fred/apps/mapsdemo
-test_or_die "group perms on mapsdemo app"
+exit_on_error "group perms on mapsdemo app"
echo "...done with permission changes."
if [ -f "$HOME/hello.txt" ]; then
# copy the most recent hello file into place for the user.
\cp -f "$FEISTY_MEOW_APEX/production/sites/cakelampvm.com/hello.txt" "$HOME"
- test_or_continue "copying hello file for user"
+ continue_on_error "copying hello file for user"
fi
##############
echo "Updating default web sites to latest version."
a2enmod ssl
- test_or_die "enabling SSL for secure websites"
+ exit_on_error "enabling SSL for secure websites"
restart_apache
- test_or_die "getting SSL loaded in apache"
+ exit_on_error "getting SSL loaded in apache"
a2dissite 000-default
- test_or_die "disabling old apache site"
+ exit_on_error "disabling old apache site"
rm -f /etc/apache2/sites-available/000-default.conf
- test_or_die "removing old apache site"
+ exit_on_error "removing old apache site"
# copy in our new version of the default page.
#hmmm: would be nice if this worked without mods for any new version, besides just 001. see apache env var file below for example implem.
\cp -f $FEISTY_MEOW_APEX/production/sites/cakelampvm.com/rolling/default_page.001/* \
/etc/apache2/sites-available
- test_or_die "installing new apache default sites"
+ exit_on_error "installing new apache default sites"
# there should only be ours at this version level and with that prefix.
a2ensite 001-*
- test_or_die "enabling new apache default sites"
+ exit_on_error "enabling new apache default sites"
restart_apache
fi
# after realizing the sentinel pattern 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"
+exit_on_error "patching samba configuration to enable write acccess on user home dirs"
echo successfully patched the samba configuration to enable writes on user home directories.
# add in a disabling of the archive bit mapping feature, which hoses up the execute bit
# if the phrase wasn't found, we need to add it.
if [ $? -ne 0 ]; then
sed -i "s/\[global\]/\[global\]\n\nmap archive = no/" /etc/samba/smb.conf
- test_or_die "patching samba configuration to turn off archive bit mapping feature"
+ exit_on_error "patching samba configuration to turn off archive bit mapping feature"
echo Successfully fixed Samba to not use the archive bit mapping feature.
fi
# plug in the new version, just stomping anything there.
# note: we only expect to have one version of the env_vars dir at a time in place in feisty...
\cp -f $FEISTY_MEOW_APEX/production/sites/cakelampvm.com/rolling/env_vars.*/env_vars_cakelampvm.conf /etc/apache2/conf-available
-test_or_die "copying environment variables file into place"
+exit_on_error "copying environment variables file into place"
# enable the new version of the config file.
a2enconf env_vars_cakelampvm
-test_or_die "enabling the new cakelampvm environment config for apache"
+exit_on_error "enabling the new cakelampvm environment config for apache"
echo Successfully configured the apache2 environment variables needed for cakelampvm.
sep
regenerate
-test_or_die "regenerating feisty meow scripts"
+exit_on_error "regenerating feisty meow scripts"
chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
-test_or_die "fix after regenerate as sudo"
+exit_on_error "fix after regenerate as sudo"
echo "
echo "Regenerating feisty meow loading dock."
regenerate
-test_or_die "regenerating feisty meow configuration"
+exit_on_error "regenerating feisty meow configuration"
chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
-test_or_die "fix after reconfigured as sudo"
+exit_on_error "fix after reconfigured as sudo"
##############
create user if not exists 'lampcake'@'%' IDENTIFIED BY 'bakecamp';
grant all privileges on *.* TO 'lampcake'@'%' with grant option;
EOF
-test_or_die "configuring root, wampcake and lampcake users on mysql"
+exit_on_error "configuring root, wampcake and lampcake users on mysql"
##############
# fix up the main web storage.
chown -R www-data:www-data /var/www
-test_or_die "chown www-data"
+exit_on_error "chown www-data"
group_perm /var/www
-test_or_die "group_perm www-data"
+exit_on_error "group_perm www-data"
##############
# set the developer user as uber owner of many things with redeveloper alias.
# (must have run feisty meow "recustomize" command at some point to enable.)
redeveloper
-test_or_die "running redeveloper to fix ownership"
+exit_on_error "running redeveloper to fix ownership"
##############
# give the developer control over the apache and bind config files, as well
# as giving the user ownership of the local feisty meow repository.
chown -R developer:developer /etc/apache2 /etc/bind
-test_or_die "chown apache2 and bind to developer"
+exit_on_error "chown apache2 and bind to developer"
group_perm /etc/apache2 /etc/bind
-test_or_die "group perms on apache2 and bind"
+exit_on_error "group perms on apache2 and bind"
chown -R developer:developer /opt/feistymeow.org
-test_or_die "chown feisty meow to developer"
+exit_on_error "chown feisty meow to developer"
group_perm /opt/feistymeow.org
-test_or_die "group perms on feisty meow"
+exit_on_error "group perms on feisty meow"
##############
sep
regenerate
-test_or_die "regenerating feisty meow scripts"
+exit_on_error "regenerating feisty meow scripts"
chown -R "$(logname)":"$(logname)" /home/$(logname)/.[a-zA-Z0-9]*
-test_or_die "fix after regenerate as sudo"
+exit_on_error "fix after regenerate as sudo"
echo "
# 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"
+exit_on_error "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
# configure feisty revision control to ignore vendor folders.
export NO_CHECKIN_VENDOR=true
if [ ! -d "$appdir" ]; then
echo "$(date_stringer): Creating the apps directory: $appdir" >> "$SSM_LOG_FILE"
mkdir "$appdir"
- test_or_die "Making apps directory when not already present"
+ exit_on_error "Making apps directory when not already present"
fi
}
# try to load the config.
source "$SITE_MANAGEMENT_CONFIG_FILE"
- test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
+ exit_on_error "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE"
return 0
}
exit 1
elif [ $numdirs -eq 1 ]; then
app_dirname="$(basename $(find "$appsdir" -mindepth 1 -maxdepth 1 -type d) )"
- test_or_die "Guessing application folder"
+ exit_on_error "Guessing application folder"
else
# if more than one folder, force user to choose.
# Reference: https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script
PS3="$holdps3"
fi
test_app_folder "$appsdir" "$app_dirname"
- test_or_die "Testing application folder: $app_dirname"
+ exit_on_error "Testing application folder: $app_dirname"
echo "Application folder is: $app_dirname"
return 0
if [ ! -d "$combo" ]; then
echo "$(date_stringer): Creating app directory: $combo" >> "$SSM_LOG_FILE"
mkdir "$combo"
- test_or_die "Making application directory when not already present"
+ exit_on_error "Making application directory when not already present"
fi
locate_config_file "$dir"
if [ -f "$site_dir/bin/cake" ]; then
sudo chmod -R a+rx "$site_dir/bin/cake"
- test_or_die "Enabling execute bit on cake binary"
+ exit_on_error "Enabling execute bit on cake binary"
fi
if [ -d "$site_dir/logs" ]; then
sudo chmod -R g+w "$site_dir/logs"
- test_or_die "Enabling group write on site's Logs directory"
+ exit_on_error "Enabling group write on site's Logs directory"
fi
if [ -d "$site_dir/tmp" ]; then
sudo chmod -R g+w "$site_dir/tmp"
- test_or_die "Enabling group write on site's tmp directory"
+ exit_on_error "Enabling group write on site's tmp directory"
fi
}
if [ -f "$site_dir/bin/cake" ]; then
# flush any cached objects from db.
"$site_dir/bin/cake" orm_cache clear
- test_or_die "Clearing ORM cache"
+ exit_on_error "Clearing ORM cache"
fi
}
unset site_store_path
pushd "$full_app_dir" &>/dev/null
- test_or_die "Switching to our app dir '$full_app_dir'"
+ exit_on_error "Switching to our app dir '$full_app_dir'"
local complete_path="$full_app_dir/$checkout_dirname"
if [ -d "$checkout_dirname" ]; then
# checkout directory exists, so let's check it.
pushd "$checkout_dirname" &>/dev/null
- test_or_die "Switching to our checkout directory: $checkout_dirname"
+ exit_on_error "Switching to our checkout directory: $checkout_dirname"
# ask for repository name (without .git).
if git rev-parse --git-dir > /dev/null 2>&1; then
# a repository was found, so update the version here and leave.
echo "Repository $repo_name exists. Updating it."
rgetem
- test_or_die "Recursive checkout on: $complete_path"
+ exit_on_error "Recursive checkout on: $complete_path"
else
# 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"
+ exit_on_error "Git clone of repository: $repo_name"
fi
#not doing this here since powerup uses this and has no sudo.
local site_store_path="$1"; shift
pushd "$site_store_path" &>/dev/null
- test_or_die "Switching to our app dir '$site_store_path'"
+ exit_on_error "Switching to our app dir '$site_store_path'"
echo "Updating site with composer..."
composer -n install
- test_or_die "Composer installation step on '$site_store_path'."
+ exit_on_error "Composer installation step on '$site_store_path'."
echo "Site updated."
#hmmm: argh global
# jump into the site path so we can start making relative links.
pushd "$site_store_path" &>/dev/null
- test_or_die "Switching to our app dir '$site_store_path'"
+ exit_on_error "Switching to our app dir '$site_store_path'"
pushd webroot &>/dev/null
# remove all symlinks that might plague us.
find . -maxdepth 1 -type l -exec rm -f {} ';'
- test_or_die "Cleaning out links in webroot"
+ exit_on_error "Cleaning out links in webroot"
# link in the avcore plugin.
make_safe_link "../vendor/siteavenger/avcore/webroot" avcore
if [ -L public ]; then
# public is a symlink.
\rm public
- test_or_die "Removing public directory symlink"
+ exit_on_error "Removing public directory symlink"
elif [ -d public ]; then
# public is a folder with default files.
#hmmm: is that safe?
\rm -rf public
- test_or_die "Removing public directory and contents"
+ exit_on_error "Removing public directory and contents"
fi
# create the main 'public' symlink
#hmmm: argh global
make_safe_link $CHECKOUT_DIR_NAME/webroot public
- test_or_die "Creating link to webroot called 'public'"
+ exit_on_error "Creating link to webroot called 'public'"
#hmmm: public/$themelower/im will be created automatically by system user with appropriate permissions
echo "$(date_stringer): Chowning the app folder to be owned by: $user_name" >> "$SSM_LOG_FILE"
#hmmm: have to hope for now for standard group named after user
sudo chown -R "$user_name:$user_name" "$combo"
- test_or_die "Chowning $combo to be owned by $user_name"
+ exit_on_error "Chowning $combo to be owned by $user_name"
else
echo "$(date_stringer): user name failed checks for chowning, was found as '$user_name'" >> "$SSM_LOG_FILE"
fi
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
-test_or_die "finding and testing app folder"
+exit_on_error "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
# 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"
+exit_on_error "Updating the repository storage directory"
sep
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
-test_or_die "finding and testing app folder"
+exit_on_error "finding and testing app folder"
# where we expect to find our checkout folder underneath.
full_app_dir="$BASE_APPLICATION_PATH/$app_dirname"
# 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"
+exit_on_error "Updating the repository storage directory"
####
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
-test_or_die "finding and testing app folder"
+exit_on_error "finding and testing app folder"
#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"
+exit_on_error "Setting up domain: $DOMAIN_NAME"
sep
# add the main website as specified by the domain name they gave us.
sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$DOMAIN_NAME"
-test_or_die "Setting up apache site for: $APPLICATION_NAME"
+exit_on_error "Setting up apache site for: $APPLICATION_NAME"
# make the shadow site also, which always ends in cakelampvm.com.
shadow_domain="${APPLICATION_NAME}.cakelampvm.com"
if [ "$shadow_domain" != "$DOMAIN_NAME" ]; then
sudo bash "$FEISTY_MEOW_SCRIPTS/system/add_apache_site.sh" "$APPLICATION_NAME" "$shadow_domain"
- test_or_die "Setting up shadow apache site on '$shadow_domain'"
+ exit_on_error "Setting up shadow apache site on '$shadow_domain'"
fi
sep
else
test_app_folder "$BASE_APPLICATION_PATH" "$app_dirname"
fi
-test_or_die "finding and testing app folder"
+exit_on_error "finding and testing app folder"
sep
sudo bash "$FEISTY_MEOW_SCRIPTS/system/remove_apache_site.sh" "$DOMAIN_NAME"
-test_or_die "dropping apache site for: $DOMAIN_NAME"
+exit_on_error "dropping apache site for: $DOMAIN_NAME"
# drop the shadow site too.
shadow_domain="${APPLICATION_NAME}.cakelampvm.com"
if [ "$shadow_domain" != "$DOMAIN_NAME" ]; then
sudo bash "$FEISTY_MEOW_SCRIPTS/system/remove_apache_site.sh" "$shadow_domain"
- test_or_die "dropping shadow apache site on '$shadow_domain'"
+ exit_on_error "dropping shadow apache site on '$shadow_domain'"
fi
sep
#echo "!! domain being removed is: $DOMAIN_NAME"
sudo bash "$FEISTY_MEOW_SCRIPTS/system/remove_domain.sh" "$DOMAIN_NAME"
-test_or_die "dropping domain: $DOMAIN_NAME"
+exit_on_error "dropping domain: $DOMAIN_NAME"
sep
fi
/bin/dd if=/dev/zero of=/var/swap.${SWAP_INSTANCE} bs=1M count=${SWAP_SIZE}
-test_or_die "creating swap file"
+exit_on_error "creating swap file"
/bin/chmod 600 /var/swap.${SWAP_INSTANCE}
-test_or_die "setting swap file permissions"
+exit_on_error "setting swap file permissions"
/sbin/mkswap /var/swap.${SWAP_INSTANCE}
-test_or_die "formatting swap file as swap partition"
+exit_on_error "formatting swap file as swap partition"
/sbin/swapon /var/swap.${SWAP_INSTANCE}
-test_or_die "enabling new swap partition"
+exit_on_error "enabling new swap partition"
free
if [ -f "$domain_file" ]; then
# don't destroy, just shuffle.
\mv -f "$domain_file" "/tmp/$(basename ${domain_file})-old-${RANDOM}"
- test_or_die "removing domain file: $domain_file"
+ exit_on_error "removing domain file: $domain_file"
else
echo "Did not see a domain file to remove: $domain_file"
fi
# 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"
+ exit_on_error "setting ownership on: $domain_file"
}
# takes a zone back out of the local conf file for bind
# 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"
+ exit_on_error "setting ownership on: /etc/bind/named.conf.local"
}
# zaps a subdomain out of the containing domain file.
# keep ownership for real user.
chown "$(logname):$(logname)" "/etc/bind/${containing_domain}.conf"
- test_or_die "setting ownership on: /etc/bind/${containing_domain}.conf"
+ exit_on_error "setting ownership on: /etc/bind/${containing_domain}.conf"
}
function restart_bind()
if [ -f "$site_config" ]; then
# don't destroy, just shuffle.
\mv -f "$site_config" "/tmp/$(basename ${site_config})-old-${RANDOM}"
- test_or_die "removing site config: $site_config"
+ exit_on_error "removing site config: $site_config"
else
echo "Did not see a site config to remove: $site_config"
fi
" >"$site_config"
chown "$(logname):$(logname)" "$site_config"
- test_or_die "setting ownership on: $site_config"
+ exit_on_error "setting ownership on: $site_config"
}
# stops apache from serving up the site.
local full_path="$BASE_APPLICATION_PATH/$our_app"
if [ ! -d "$full_path" ]; then
mkdir -p $full_path
- test_or_die "The app storage path could not be created.\n Path in question is: $full_path"
+ exit_on_error "The app storage path could not be created.\n Path in question is: $full_path"
fi
# now give the web server some access to the folder. this is crucial since the folders
while [[ $chow_path != $HOME ]]; do
#echo chow path is now $chow_path
chmod g+rx "$chow_path"
- test_or_die "Failed to add group permissions on the path: $chow_path"
+ exit_on_error "Failed to add group permissions on the path: $chow_path"
# reassert the user's ownership of any directories we might have just created.
chown $(logname) "$chow_path"
- test_or_die "changing ownership to user failed on the path: $chow_path"
+ exit_on_error "changing ownership to user failed on the path: $chow_path"
chow_path="$(dirname "$chow_path")"
done
}
source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
sudo apt-get update -y
-test_or_die "problem while doing 'apt-get update'"
+exit_on_error "problem while doing 'apt-get update'"
# newest magic to tell dpkg to go with existing config files and force non-interactive version.
sudo bash -c "\
apt-get dist-upgrade -y -o Dpkg::Options::=\"--force-confdef\" \
-o Dpkg::Options::=\"--force-confold\"; \
"
-test_or_die "problem while doing 'apt-get dist-upgrade'"
+exit_on_error "problem while doing 'apt-get dist-upgrade'"