Merge branch 'dev' of feistymeow.org:feisty_meow into dev
authorChris Koeritz <fred@gruntose.com>
Sun, 12 Nov 2017 03:55:59 +0000 (03:55 +0000)
committerChris Koeritz <fred@gruntose.com>
Sun, 12 Nov 2017 03:55:59 +0000 (03:55 +0000)
scripts/core/common.alias
scripts/core/functions.sh
scripts/core/generate_aliases.pl
scripts/core/variables.sh
scripts/customize/fred/refred.sh
scripts/customize/fred/scripts/cakelampvm/revamp_web_permissions.sh
scripts/site_avenger/standup.sh

index e311dc28bff7a691a3dec4d2cf7b081bea511dcf..9d4049e5d253fade8e7cd2a325a24c5b94004d18 100644 (file)
@@ -85,6 +85,15 @@ 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?"'
index 9dcfce80b35a5565c50868bf5f8cecb5707b24d9..6797708525179750e9e84c5de98e4b211c44c2de 100644 (file)
@@ -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.
index 4ed01fb74641794fe21613eeb98ee0d4e35d1513..99f17cfd7e906137c6e257ce60a7024447889f9a 100644 (file)
@@ -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";
 }
 
 ##############
index b6311dacff8517b02357178abcc4ff9a3f09ab6f..a937d05dba10fa66be708817bc2c096956ff0f7a 100644 (file)
@@ -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
index 2f00854a2c675b44ff9738dd50460cae6de3571b..c99b2d11fde01fb8766592e27943504ab258f0f9 100644 (file)
@@ -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
 
index af9693f076f5653eb20f824797a44ff3049d5f52..f474b2dab1490cfd8d09a0f63d91f4d40a8f5598 100755 (executable)
@@ -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 \
+  /
 
+##############
index 2ae953bb53409badf3ae85cafce07eee893d513f..ee4a0026e7f613ba091b9ef1dca6ece6a5c066b4 100644 (file)
@@ -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