From: Fred T. Hamster Date: Sun, 12 Nov 2017 05:13:14 +0000 (-0500) Subject: Merge branch 'dev' of feistymeow.org:feisty_meow into dev X-Git-Tag: 2.140.98^2~3^2~5^2~1 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=b100c8248c3967b7245fbecd76d5cba2d5f9f954;hp=b71c80e75f48a075d39f6452d0acb4405b0c4cc4;p=feisty_meow.git Merge branch 'dev' of feistymeow.org:feisty_meow into dev merging onto wildmutt --- diff --git a/infobase/feisty_inits/dot.bashrc-root b/infobase/feisty_inits/dot.bashrc-root index 20a9023f..1b1dd1e2 100644 --- a/infobase/feisty_inits/dot.bashrc-root +++ b/infobase/feisty_inits/dot.bashrc-root @@ -26,6 +26,8 @@ export FEISTY_MEOW_APEX="/opt/feistymeow.org/feisty_meow" # the "fredme" macro enables the feisty_meow environment. alias fredme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"' +# synonym for fredme. +alias feistyme='source "$FEISTY_MEOW_APEX/scripts/core/launch_feisty_meow.sh"' # if not commented out, then feisty meow will run all the unit tests during builds. #export RUN_ALL_TESTS=true diff --git a/scripts/core/common.alias b/scripts/core/common.alias index 1a830c84..9d4049e5 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -79,6 +79,21 @@ define_yeti_alias up='cd ..' ############## +# some information about the feisty meow codebase itself. + +define_yeti_alias feisty_branch='pushd $FEISTY_MEOW_APEX ; git branch ; popd' + +############## + +# some important retreads on aliases that provide a sudo-ized version of other scripts. + +define_yeti_alias standup="bash \"$FEISTY_MEOW_SCRIPTS/site_avenger/standup.sh\"" + +#hmmm: some magma intrusions from the fred customizations... +define_yeti_alias revamp_web_permissions="bash \"$FEISTY_MEOW_SCRIPTS/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh" + +############## + # extended aliases for meta-operations. define_yeti_alias dvd_rip='vobcopy -m' define_yeti_alias blu_rip='echo "what would this command be?"' diff --git a/scripts/core/connect_feisty_meow.sh b/scripts/core/connect_feisty_meow.sh index 9a5c81d5..6a226b8d 100644 --- a/scripts/core/connect_feisty_meow.sh +++ b/scripts/core/connect_feisty_meow.sh @@ -11,16 +11,31 @@ export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )" echo calculated apex as $FEISTY_MEOW_APEX +do_root="$1"; shift + if [ -f "$HOME/.bashrc" ] && grep -q "launch_feisty_meow.sh" "$HOME/.bashrc"; then # the stanza for loading feisty meow already seems to be present. echo "Feisty Meow already seems to be configured in '~/.bashrc'." else - # stuff the normal user init file into .bashrc. not appropriate for root probably, but - # this is the easy quick start script for normal folks. - cat $FEISTY_MEOW_APEX/infobase/feisty_inits/dot.bashrc-normal-user | - sed -e \ - "s?FEISTY_MEOW_APEX=\".*\"?FEISTY_MEOW_APEX=\"$FEISTY_MEOW_APEX\"?" \ - >> "$HOME/.bashrc" - echo "Feisty Meow is now configured in '~/.bashrc'." + # check for the --root flag to see if they're trying to get the root version of inits. + if [ "$do_root" != "--root" ]; then + # stuff the "normal user" init file into .bashrc. not appropriate for root. + # this is the easy and quick start script for most folks. + cat $FEISTY_MEOW_APEX/infobase/feisty_inits/dot.bashrc-normal-user | + sed -e \ + "s?FEISTY_MEOW_APEX=\".*\"?FEISTY_MEOW_APEX=\"$FEISTY_MEOW_APEX\"?" \ + >> "$HOME/.bashrc" + echo "Feisty Meow is now configured in '~/.bashrc' for standard users." + else + # stuff the root user init file into .bashrc. this one doesn't automatically load + # feisty meow. instead, it provides a fredme macro to load the feisty meow scripts. + # fredme comes from the main author being fred t. hamster. we have since added a + # feistyme macro too, to be less personalized... + cat $FEISTY_MEOW_APEX/infobase/feisty_inits/dot.bashrc-root | + sed -e \ + "s?FEISTY_MEOW_APEX=\".*\"?FEISTY_MEOW_APEX=\"$FEISTY_MEOW_APEX\"?" \ + >> "$HOME/.bashrc" + echo "Feisty Meow is now configured in '~/.bashrc' for the root user." + fi fi diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 9dcfce80..67977085 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -363,14 +363,15 @@ if [ -z "$skip_all" ]; then # sudo function wraps the normal sudo by ensuring we replace the terminal # label if they're doing an su with the sudo. function sudo() { -# local first_command="$1" save_terminal_title /usr/bin/sudo "$@" + retval=$? restore_terminal_title # if [ "$first_command" == "su" ]; then # # yep, they were doing an su, but they're back now. # label_terminal_with_info # fi + return $retval } # trashes the .#blah files that cvs and subversion leave behind when finding conflicts. diff --git a/scripts/core/generate_aliases.pl b/scripts/core/generate_aliases.pl index 4ed01fb7..99f17cfd 100644 --- a/scripts/core/generate_aliases.pl +++ b/scripts/core/generate_aliases.pl @@ -43,11 +43,10 @@ sub make_alias { sub make_bash_alias { local($aliasname) = shift(@_); local($full_alias) = $aliasname; +#print "full alias is $full_alias\n"; $aliasname =~ s/^.*\/([^\/]*)/\1/; #print "alias became $aliasname\n"; - local($source_dir) = shift(@_); -#print "bash alias is $aliasname, dir is $source_dir\n"; - print she "define_yeti_alias $aliasname=\"bash $source_dir/$full_alias.sh\"\n"; + print she "define_yeti_alias $aliasname=\"bash $full_alias.sh\"\n"; } # makes an alias for a perl script given the alias name. @@ -56,9 +55,7 @@ sub make_perl_alias { local($full_alias) = $aliasname; $aliasname =~ s/^.*\/([^\/]*)/\1/; #print "alias became $aliasname\n"; - local($source_dir) = shift(@_); -#print "perl alias is $aliasname, dir is $source_dir\n"; - print she "define_yeti_alias $aliasname=\"perl $source_dir/$full_alias.pl\"\n"; + print she "define_yeti_alias $aliasname=\"perl $full_alias.pl\"\n"; } ############## diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index b6311dac..a937d05d 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -149,11 +149,15 @@ define_yeti_variable DEFAULT_FEISTYMEOW_ORG_DIR=/opt/feistymeow.org ############## - # umask sets a permission mask for all file creations. - # this mask disallows writes by "group" and "others". - umask 022 - # this mask disallows writes by the "group" and disallows "others" completely. + # umask sets a permission mask for all file creations. we don't set this for the users any + # more; they should set it themselves. this is just documentation. + # + # this mask disallows writes by the "group" and disallows all permissions for "others". #umask 027 + # this mask disallows writes by "group" and "others". + #umask 022 + # this mask allows writes by "group" but not by "others". + #umask 002 # ulimit sets user limits. we set the maximum allowed core dump file size # to zero, because it is obnoxious to see the core dumps from crashed diff --git a/scripts/customize/fred/refred.sh b/scripts/customize/fred/refred.sh index 2f00854a..c99b2d11 100644 --- a/scripts/customize/fred/refred.sh +++ b/scripts/customize/fred/refred.sh @@ -19,30 +19,41 @@ function refred() # 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" fi # iterate across the list of dirs we want fred to own and change their ownership. for dirname in /home/fred $DEFAULT_FEISTYMEOW_ORG_DIR /usr/local/fred /home/games $arch_addin; do if [ -d "$dirname" ]; then echo "refred on '$dirname'" - sudo chown -R fred:fred $dirname + sudo chown -R fred:fred "$dirname" + test_or_die "chowning for fred: $dirname" fi done # special case for archives directory. if [ -d /z/stuffing -o -L /z/stuffing ]; then - sudo chown fred:fred /z; sudo chmod g+rx,o+rx /z - sudo chown fred:fred /z/stuffing; sudo chmod g+rx,o-rwx /z/stuffing + sudo chown fred:fred /z + test_or_die "chowning /z for fred" + sudo chmod g+rx,o+rx /z + test_or_die "chmodding /z/ for fred" + sudo chown fred:fred /z/stuffing + test_or_die "chowning /z/stuffing for fred" + sudo chmod g+rx,o-rwx /z/stuffing + test_or_die "chmodding /z/stuffing for fred" pushd /z/stuffing &>/dev/null if [ -d archives -o -L archives ]; then sudo chown fred:fred archives + test_or_die "chowning /z/stuffing/archives for fred" sudo chmod -R g+rwx archives + test_or_die "chmodding /z/stuffing/archives for fred" fi popd &>/dev/null fi # make the logs readable by normal humans. sudo bash $FEISTY_MEOW_SCRIPTS/security/normal_perm.sh /var/log + test_or_die "setting normal perms on /var/log" } # this block should execute when the script is actually run, rather @@ -50,6 +61,8 @@ function refred() if [[ $0 =~ .*refred\.sh.* ]]; then THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" source "$THISDIR/../../core/launch_feisty_meow.sh" + test_or_die "sourcing the feisty meow launcher" refred + test_or_die "refredding process" fi diff --git a/scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh b/scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh index af9693f0..f474b2da 100755 --- a/scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh +++ b/scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh @@ -1,21 +1,42 @@ -# change the owner for the web roots to the apache user, www-data. -sudo chown -R www-data:www-data /var/www +# fixes the cakelampvm permissions according to the way. + +source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh" + +############## + +if (( $EUID != 0 )); then + echo "This script must be run as root or sudo." + exit 1 +fi + +############## # make sure we have the appropriate access on a few key folders. -sudo chmod u+rwx,g+rx /var/www +normal_perm /var/www + +############## + +# change the owner for the web roots to the apache user, www-data. +sudo chown -R www-data:www-data /var/www # put a couple specific ownerships into play so the appropriate user has full access. -sudo chown -R developer:developer /var/www/defaultcake.cakelampvm.com -sudo chown -R fred:fred /var/www/webwork.repository -## add others here for your own projects. +sudo chown -R developer:developer /home/developer \ + /etc/apache2 \ + /etc/bind \ -# these directories will be given group permissons that enable web server access. -DIR_LIST="/var/www/defaultcake.cakelampvm.com /var/www/webwork.repository" -# add in group permissions to allow the web server to serve the pages properly. -for currdir in $DIR_LIST; do - sudo find $currdir -type d -exec chmod -R u+rwx,g+rwx,o-rwx {} ';' - sudo find $currdir -type f -exec chmod -R u+rw,g+rw,o-rwx {} ';' -done +sudo chown -R fred:fred /home/fred \ + /opt/feistymeow.org \ + /home/archives/stuffing \ + + +############## + +# these directories will be given group permissons that enable web server access. +group_perm /var/www/html \ + /opt/feistymeow.org \ + /etc/apache \ + / +############## diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index 491dd17c..8c7e9961 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -444,8 +444,8 @@ function generate_rev_ctrl_filelist() local sortfile=$(mktemp /tmp/zz_checkin_sort.XXXXXX) sort <"$tempfile" >"$sortfile" - \rm "$tempfile" echo "$sortfile" + \rm "$tempfile" } # iterates across a list of directories contained in a file (first parameter). @@ -480,6 +480,6 @@ function perform_revctrl_action_on_file() restore_terminal_title - rm $tempfile + rm "$tempfile" } diff --git a/scripts/site_avenger/standup.sh b/scripts/site_avenger/standup.sh index 762bd1ef..ee4a0026 100644 --- a/scripts/site_avenger/standup.sh +++ b/scripts/site_avenger/standup.sh @@ -31,6 +31,11 @@ overridden by setting the SITE_MANAGEMENT_CONFIG_FILE environment variable." # check for parameters. app_dirname="$1"; shift +if (( $EUID != 0 )); then + echo "This script must be run as root or sudo." + exit 1 +fi + if [ -z "$app_dirname" ]; then print_instructions fi @@ -53,77 +58,9 @@ test_or_die "Setting up apache site for: $APPLICATION_NAME" powerup "$APPLICATION_NAME" "$REPO_NAME" "$THEME_NAME" - - - - sep echo " Finished standing up the full domain and site in: ${app_dirname}" -#leave before old crud below -exit 0 - - - - - - - - - - - - - - - - - - - - -#below is probably not needed. -# find proper webroot where the site will be initialized. -if [ -z "$app_dirname" ]; then - # no dir was passed, so guess it. - find_app_folder "$APPLICATION_DIR" -else - test_app_folder "$APPLICATION_DIR" "$app_dirname" -fi - -# where we expect to find our checkout folder underneath. -full_app_dir="$APPLICATION_DIR/$app_dirname" - -# use our default values for the repository and theme if they're not provided. -if [ -z "$repo_name" ]; then - repo_name="$app_dirname" -fi -if [ -z "$theme_name" ]; then - theme_name="$(capitalize_first_char ${app_dirname})" -fi - -echo "Repository: $repo_name" -echo "Theme name: $theme_name" -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" - -# update the site to load dependencies. -sep -composer_repuff "$site_store_path" -test_or_die "Installing site dependencies with composer" - -# set up the symbolic links needed to achieve siteliness. -sep - -create_site_links "$site_store_path" "$theme_name" - -sep - -echo "Finished powering up the site in '${app_dirname}'." -