From baf5d7c693e351bd775114380dc0111bc3e4028e Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sat, 19 May 2018 16:03:13 -0400 Subject: [PATCH] modified error handling methods test_or_die => exit_on_error test_or_continue => continue_on_error --- scripts/archival/serene_backer_upper.sh | 8 +-- scripts/buildor/refresh_gffs_build.sh | 4 +- scripts/core/functions.sh | 28 +++++----- .../developer/scripts/redeveloper.sh | 6 +- .../fred/scripts/email/filter_grabber.sh | 4 +- .../games/fallout_new_vegas_link_fixer.sh | 2 +- .../customize/fred/scripts/games/gamesaver.sh | 2 +- scripts/customize/fred/scripts/refred.sh | 6 +- scripts/rev_control/checkin.sh | 2 +- scripts/rev_control/compact_git.sh | 8 +-- scripts/rev_control/diff_repos.sh | 4 +- scripts/rev_control/getem.sh | 12 ++-- scripts/rev_control/puffer.sh | 2 +- scripts/rev_control/push_repo_downstream.sh | 10 ++-- scripts/rev_control/rcheckin.sh | 6 +- scripts/rev_control/report_new.sh | 6 +- scripts/rev_control/resolve_svn.sh | 2 +- scripts/rev_control/rgetem.sh | 6 +- scripts/rev_control/rpuffer.sh | 6 +- scripts/rev_control/version_control.sh | 54 +++++++++--------- scripts/security/cool_permissionator.sh | 22 ++++---- scripts/security/password_functions.sh | 6 +- scripts/site_avenger/avcoreup.sh | 6 +- scripts/site_avenger/clean_mapsdemo.sh | 12 ++-- scripts/site_avenger/powerup.sh | 6 +- .../site_avenger/revamp_cakelampvm_v002.sh | 56 +++++++++---------- .../site_avenger/revamp_cakelampvm_v003.sh | 24 ++++---- scripts/site_avenger/shared_site_mgr.sh | 44 +++++++-------- scripts/site_avenger/sitepush.sh | 4 +- scripts/site_avenger/siteup.sh | 4 +- scripts/site_avenger/standup.sh | 8 +-- scripts/site_avenger/teardown.sh | 8 +-- scripts/system/add_swap_mount.sh | 8 +-- scripts/system/common_sysadmin.sh | 18 +++--- scripts/system/naive_system_updater.sh | 4 +- 35 files changed, 204 insertions(+), 204 deletions(-) diff --git a/scripts/archival/serene_backer_upper.sh b/scripts/archival/serene_backer_upper.sh index 8a852601..2092f2f8 100644 --- a/scripts/archival/serene_backer_upper.sh +++ b/scripts/archival/serene_backer_upper.sh @@ -15,7 +15,7 @@ function synch_to_backup() fi echo "Synchronizing $source into $dest." synch_files "$source" "$dest" - test_or_continue "synching $source to $dest" + continue_on_error "synching $source to $dest" } ############## @@ -27,12 +27,12 @@ function synch_to_backup() # 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" ############## @@ -52,6 +52,6 @@ synch_to_backup /var/lib/mysql /z/backup/var/lib/mysql ############## #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" diff --git a/scripts/buildor/refresh_gffs_build.sh b/scripts/buildor/refresh_gffs_build.sh index dc255929..66f1028e 100644 --- a/scripts/buildor/refresh_gffs_build.sh +++ b/scripts/buildor/refresh_gffs_build.sh @@ -14,12 +14,12 @@ echo cleaning out the logs directory... 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 & ) diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index f708fe85..fc5ce4eb 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -141,7 +141,7 @@ if [ -z "$skip_all" ]; then # 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..." @@ -150,8 +150,8 @@ if [ -z "$skip_all" ]; then 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..." @@ -484,7 +484,7 @@ if [ -z "$skip_all" ]; then #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 @@ -501,19 +501,19 @@ or if you're on cygwin, then try this (if apt-cyg is available):\n 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 @@ -522,7 +522,7 @@ or if you're on cygwin, then try this (if apt-cyg is available):\n # 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 } @@ -803,7 +803,7 @@ return 0 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'." } @@ -820,7 +820,7 @@ return 0 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[@]}" @@ -881,12 +881,12 @@ return 0 # 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 @@ -921,7 +921,7 @@ return 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" @@ -957,7 +957,7 @@ return 0 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 diff --git a/scripts/customize/developer/scripts/redeveloper.sh b/scripts/customize/developer/scripts/redeveloper.sh index eeb0fbcb..85f6e28c 100644 --- a/scripts/customize/developer/scripts/redeveloper.sh +++ b/scripts/customize/developer/scripts/redeveloper.sh @@ -11,10 +11,10 @@ function do_redeveloper() # 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 diff --git a/scripts/customize/fred/scripts/email/filter_grabber.sh b/scripts/customize/fred/scripts/email/filter_grabber.sh index 1889b2fe..dcb79464 100644 --- a/scripts/customize/fred/scripts/email/filter_grabber.sh +++ b/scripts/customize/fred/scripts/email/filter_grabber.sh @@ -5,9 +5,9 @@ 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" diff --git a/scripts/customize/fred/scripts/games/fallout_new_vegas_link_fixer.sh b/scripts/customize/fred/scripts/games/fallout_new_vegas_link_fixer.sh index a9a8ed82..2475b432 100644 --- a/scripts/customize/fred/scripts/games/fallout_new_vegas_link_fixer.sh +++ b/scripts/customize/fred/scripts/games/fallout_new_vegas_link_fixer.sh @@ -31,7 +31,7 @@ function make_local_dir_link() 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 } diff --git a/scripts/customize/fred/scripts/games/gamesaver.sh b/scripts/customize/fred/scripts/games/gamesaver.sh index 80cdfd98..dc6956ec 100644 --- a/scripts/customize/fred/scripts/games/gamesaver.sh +++ b/scripts/customize/fred/scripts/games/gamesaver.sh @@ -20,7 +20,7 @@ fi 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. diff --git a/scripts/customize/fred/scripts/refred.sh b/scripts/customize/fred/scripts/refred.sh index a026b4c6..65f9c35c 100644 --- a/scripts/customize/fred/scripts/refred.sh +++ b/scripts/customize/fred/scripts/refred.sh @@ -11,10 +11,10 @@ function do_refred() # 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 diff --git a/scripts/rev_control/checkin.sh b/scripts/rev_control/checkin.sh index 5b126d9a..9bdbe5cf 100644 --- a/scripts/rev_control/checkin.sh +++ b/scripts/rev_control/checkin.sh @@ -16,7 +16,7 @@ if [ "$OS" == "Windows_NT" ]; then fi checkin_list $FULL_LIST -test_or_die "checking in list: $FULL_LIST" +exit_on_error "checking in list: $FULL_LIST" ############## diff --git a/scripts/rev_control/compact_git.sh b/scripts/rev_control/compact_git.sh index c1a22ef0..5d32cc6d 100644 --- a/scripts/rev_control/compact_git.sh +++ b/scripts/rev_control/compact_git.sh @@ -12,18 +12,18 @@ if [ -z "$prune_dir" ]; then 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 diff --git a/scripts/rev_control/diff_repos.sh b/scripts/rev_control/diff_repos.sh index eb02719e..c0d01e51 100644 --- a/scripts/rev_control/diff_repos.sh +++ b/scripts/rev_control/diff_repos.sh @@ -16,10 +16,10 @@ if [ -z "$dir" ]; then 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" diff --git a/scripts/rev_control/getem.sh b/scripts/rev_control/getem.sh index e7aeabc6..da9cb391 100644 --- a/scripts/rev_control/getem.sh +++ b/scripts/rev_control/getem.sh @@ -20,13 +20,13 @@ if [ "$(\pwd)" != "$tmpdir" ]; then 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 @@ -35,7 +35,7 @@ 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 @@ -46,7 +46,7 @@ if [ "$OS" == "Windows_NT" ]; then 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" ############## diff --git a/scripts/rev_control/puffer.sh b/scripts/rev_control/puffer.sh index c02ef3bc..27ab4d33 100644 --- a/scripts/rev_control/puffer.sh +++ b/scripts/rev_control/puffer.sh @@ -20,7 +20,7 @@ if [ "$OS" == "Windows_NT" ]; then fi puff_out_list $FULL_LIST -test_or_die "puffing out list: $FULL_LIST" +exit_on_error "puffing out list: $FULL_LIST" ############## diff --git a/scripts/rev_control/push_repo_downstream.sh b/scripts/rev_control/push_repo_downstream.sh index d65c2f45..281cc7e9 100644 --- a/scripts/rev_control/push_repo_downstream.sh +++ b/scripts/rev_control/push_repo_downstream.sh @@ -44,21 +44,21 @@ if [ -z "$dir" ]; then 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 diff --git a/scripts/rev_control/rcheckin.sh b/scripts/rev_control/rcheckin.sh index 1c5400fb..268bed81 100644 --- a/scripts/rev_control/rcheckin.sh +++ b/scripts/rev_control/rcheckin.sh @@ -15,11 +15,11 @@ if [ -z "$dir" ]; then 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" diff --git a/scripts/rev_control/report_new.sh b/scripts/rev_control/report_new.sh index e51e90c7..c2f3a032 100644 --- a/scripts/rev_control/report_new.sh +++ b/scripts/rev_control/report_new.sh @@ -16,11 +16,11 @@ if [ -z "$dir" ]; then 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" diff --git a/scripts/rev_control/resolve_svn.sh b/scripts/rev_control/resolve_svn.sh index b7597973..e1d4913a 100644 --- a/scripts/rev_control/resolve_svn.sh +++ b/scripts/rev_control/resolve_svn.sh @@ -16,6 +16,6 @@ if [ -z "$filename" ]; then 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" diff --git a/scripts/rev_control/rgetem.sh b/scripts/rev_control/rgetem.sh index 4c29c038..eeb86f70 100644 --- a/scripts/rev_control/rgetem.sh +++ b/scripts/rev_control/rgetem.sh @@ -15,11 +15,11 @@ if [ -z "$dir" ]; then 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" diff --git a/scripts/rev_control/rpuffer.sh b/scripts/rev_control/rpuffer.sh index 5032bc12..0cb0345c 100644 --- a/scripts/rev_control/rpuffer.sh +++ b/scripts/rev_control/rpuffer.sh @@ -19,11 +19,11 @@ if [ -z "$dir" ]; then 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" diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 0c7ac401..f7dcb797 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -84,7 +84,7 @@ function do_checkin() 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 @@ -93,13 +93,13 @@ function do_checkin() 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 @@ -108,7 +108,7 @@ function do_checkin() # 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 @@ -116,7 +116,7 @@ function do_checkin() #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 @@ -137,7 +137,7 @@ function do_checkin() # 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 @@ -163,13 +163,13 @@ function do_diff # 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 @@ -194,10 +194,10 @@ function do_report_new 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 @@ -226,7 +226,7 @@ function checkin_list() # 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 @@ -234,7 +234,7 @@ function checkin_list() 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 @@ -266,7 +266,7 @@ function puff_out_list() # 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 @@ -274,7 +274,7 @@ function puff_out_list() 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 @@ -379,7 +379,7 @@ function do_careful_git_update() { 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 @@ -400,7 +400,7 @@ function do_careful_git_update() # 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" @@ -413,7 +413,7 @@ function do_careful_git_update() # 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" @@ -425,12 +425,12 @@ function do_careful_git_update() # 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. @@ -439,7 +439,7 @@ function do_careful_git_update() #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 } @@ -464,14 +464,14 @@ function do_update() $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 @@ -479,7 +479,7 @@ function do_update() 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. @@ -510,7 +510,7 @@ function checkout_list() # 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 @@ -518,7 +518,7 @@ function checkout_list() 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 @@ -574,7 +574,7 @@ function perform_revctrl_action_on_file() 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" diff --git a/scripts/security/cool_permissionator.sh b/scripts/security/cool_permissionator.sh index 3d0dc8ea..e17f87a9 100644 --- a/scripts/security/cool_permissionator.sh +++ b/scripts/security/cool_permissionator.sh @@ -24,7 +24,7 @@ function reapply_cool_permissions() # 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. @@ -43,33 +43,33 @@ function reapply_cool_permissions() 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 @@ -83,10 +83,10 @@ 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" + 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 diff --git a/scripts/security/password_functions.sh b/scripts/security/password_functions.sh index f1e0df13..490b94d8 100644 --- a/scripts/security/password_functions.sh +++ b/scripts/security/password_functions.sh @@ -46,13 +46,13 @@ and (2) the password that should be stored. 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 diff --git a/scripts/site_avenger/avcoreup.sh b/scripts/site_avenger/avcoreup.sh index 106c1fd3..5ccc61f7 100644 --- a/scripts/site_avenger/avcoreup.sh +++ b/scripts/site_avenger/avcoreup.sh @@ -27,7 +27,7 @@ if [ -z "$app_dirname" ]; then 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" @@ -35,7 +35,7 @@ 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 @@ -44,7 +44,7 @@ else 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}." diff --git a/scripts/site_avenger/clean_mapsdemo.sh b/scripts/site_avenger/clean_mapsdemo.sh index 5054cdd7..e2c8755e 100644 --- a/scripts/site_avenger/clean_mapsdemo.sh +++ b/scripts/site_avenger/clean_mapsdemo.sh @@ -9,29 +9,29 @@ echo Doing some git repository maintenance in fred account. # # 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 diff --git a/scripts/site_avenger/powerup.sh b/scripts/site_avenger/powerup.sh index 28e03240..ef4c0976 100644 --- a/scripts/site_avenger/powerup.sh +++ b/scripts/site_avenger/powerup.sh @@ -68,7 +68,7 @@ if [ -z "$app_dirname" ]; then 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" @@ -96,12 +96,12 @@ var CHECKOUT_DIR_NAME DEFAULT_REPOSITORY_ROOT # 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 diff --git a/scripts/site_avenger/revamp_cakelampvm_v002.sh b/scripts/site_avenger/revamp_cakelampvm_v002.sh index 7c479d04..205fcb4c 100644 --- a/scripts/site_avenger/revamp_cakelampvm_v002.sh +++ b/scripts/site_avenger/revamp_cakelampvm_v002.sh @@ -46,9 +46,9 @@ 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" ############## @@ -69,7 +69,7 @@ mysql -u root -p"$mysql_passwd" &>/dev/null </dev/null # 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. @@ -377,9 +377,9 @@ fi 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 " diff --git a/scripts/site_avenger/revamp_cakelampvm_v003.sh b/scripts/site_avenger/revamp_cakelampvm_v003.sh index 66e4c89b..5cd4a578 100644 --- a/scripts/site_avenger/revamp_cakelampvm_v003.sh +++ b/scripts/site_avenger/revamp_cakelampvm_v003.sh @@ -46,9 +46,9 @@ 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" ############## @@ -69,7 +69,7 @@ mysql -u root -p"$mysql_passwd" &>/dev/null <> "$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 } @@ -63,7 +63,7 @@ the standard pattern for cakephp projects." >> "$SSM_LOG_FILE" # 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 } @@ -94,7 +94,7 @@ function find_app_folder() 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 @@ -115,7 +115,7 @@ function find_app_folder() 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 @@ -133,7 +133,7 @@ function test_app_folder() 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" @@ -148,17 +148,17 @@ function fix_site_perms() 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 } @@ -170,7 +170,7 @@ function clear_orm_cache() 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 } @@ -193,7 +193,7 @@ echo "$(date_stringer): $(var full_app_dir checkout_dirname repo_root repo_name) 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" @@ -203,7 +203,7 @@ echo "$(date_stringer): $(var full_app_dir checkout_dirname repo_root repo_name) 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 @@ -225,12 +225,12 @@ echo "$(date_stringer): $(var full_app_dir checkout_dirname repo_root repo_name) # 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. @@ -251,12 +251,12 @@ function composer_repuff() 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 @@ -290,13 +290,13 @@ function create_site_links() # 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 @@ -323,18 +323,18 @@ function create_site_links() 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 @@ -376,7 +376,7 @@ function fix_appdir_ownership() 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 diff --git a/scripts/site_avenger/sitepush.sh b/scripts/site_avenger/sitepush.sh index 8a69d5da..503ae134 100644 --- a/scripts/site_avenger/sitepush.sh +++ b/scripts/site_avenger/sitepush.sh @@ -28,7 +28,7 @@ if [ -z "$app_dirname" ]; then 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" @@ -43,7 +43,7 @@ sep # 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 diff --git a/scripts/site_avenger/siteup.sh b/scripts/site_avenger/siteup.sh index 8c186ad9..d3ff8125 100644 --- a/scripts/site_avenger/siteup.sh +++ b/scripts/site_avenger/siteup.sh @@ -28,7 +28,7 @@ if [ -z "$app_dirname" ]; then 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" @@ -43,7 +43,7 @@ sep # 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" #### diff --git a/scripts/site_avenger/standup.sh b/scripts/site_avenger/standup.sh index 72378ca8..ca9ee768 100644 --- a/scripts/site_avenger/standup.sh +++ b/scripts/site_avenger/standup.sh @@ -64,24 +64,24 @@ if [ -z "$app_dirname" ]; then 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 diff --git a/scripts/site_avenger/teardown.sh b/scripts/site_avenger/teardown.sh index 68fa0e14..13d4b3a9 100644 --- a/scripts/site_avenger/teardown.sh +++ b/scripts/site_avenger/teardown.sh @@ -56,18 +56,18 @@ if [ -z "$app_dirname" ]; then 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 @@ -75,7 +75,7 @@ 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 diff --git a/scripts/system/add_swap_mount.sh b/scripts/system/add_swap_mount.sh index b400fcb9..dc14f84e 100644 --- a/scripts/system/add_swap_mount.sh +++ b/scripts/system/add_swap_mount.sh @@ -39,16 +39,16 @@ if [ -z "$SWAP_SIZE" ]; then 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 diff --git a/scripts/system/common_sysadmin.sh b/scripts/system/common_sysadmin.sh index 7f831e21..0deb7257 100644 --- a/scripts/system/common_sysadmin.sh +++ b/scripts/system/common_sysadmin.sh @@ -17,7 +17,7 @@ function remove_domain_file() 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 @@ -61,7 +61,7 @@ ${domain_name}. IN A ${IP_ADDRESS} # 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 @@ -100,7 +100,7 @@ zone \"${domain_name}\" in { # 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. @@ -170,7 +170,7 @@ function add_new_subdomain() # 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() @@ -217,7 +217,7 @@ function remove_apache_config() 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 @@ -278,7 +278,7 @@ function write_apache_config() " >"$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. @@ -347,7 +347,7 @@ function maybe_create_site_storage() 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 @@ -359,10 +359,10 @@ function maybe_create_site_storage() 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 } diff --git a/scripts/system/naive_system_updater.sh b/scripts/system/naive_system_updater.sh index 7790fe88..cf9cbf89 100644 --- a/scripts/system/naive_system_updater.sh +++ b/scripts/system/naive_system_updater.sh @@ -2,7 +2,7 @@ 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 "\ @@ -10,6 +10,6 @@ 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'" -- 2.34.1