getting prepped for better sudo script
authorChris Koeritz <cak0l@virginia.edu>
Tue, 26 May 2020 20:50:36 +0000 (16:50 -0400)
committerChris Koeritz <cak0l@virginia.edu>
Tue, 26 May 2020 20:50:36 +0000 (16:50 -0400)
these changes pave the way for sudo to seamlessly inherit *most* of the
environment of the user without leaving scads of feisty meow junk or user
specific stuff behind.

scripts/core/functions.sh
scripts/core/launch_feisty_meow.sh
scripts/core/variables.sh

index 6389b6684b4cc7215613a69c2b3ecb52aae1a6b1..e56d8c5f18cb3b0ebb1301a8f3ba05d9d058e2f7 100644 (file)
@@ -400,13 +400,13 @@ if [ -z "$skip_all" ]; then
     fi
   }
   
-  # switches from an X:/ form to a /cygdrive/X/path form.  this is only useful
-  # for the cygwin environment currently.
-  function dos_to_unix_path() {
-    # we always remove dos slashes in favor of forward slashes.
-#old:    echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/'
-         echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/cygdrive\/\1\/\2/'
-  }
+#  # switches from an X:/ form to a /cygdrive/X/path form.  this is only useful
+#  # for the cygwin environment currently.
+#  function dos_to_unix_path() {
+#    # we always remove dos slashes in favor of forward slashes.
+##old:    echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/'
+#         echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/cygdrive\/\1\/\2/'
+#  }
 
   # returns a successful value (0) if this system is debian or ubuntu.
   function debian_like() {
index 913f82b43b2ac6c53273ecb2caa368799d5d21cf..aef7f199f4031eb233639a09d60e1583d8ed58f7 100644 (file)
@@ -86,6 +86,13 @@ if [ "$NO_REPAIRS_NEEDED" == "true" ]; then
   # some preconditions we want to establish before loading anything...
   
   # make sure that aliases can be used in non-interactive shells.
+  # this causes all aliases that are currently defined for this shell to
+  # be inherited by subshells that this shell starts.  this is unusual,
+  # but is preferred for my workflow in feisty meow scripts; it saves me
+  # time re-adding aliases if i can count on them already being there.
+  # this is a problem if you *don't* want the aliases there though.  we can
+  # solve that problem by running bash with the "-O expand_aliases" flags to
+  # stop the expansion for the next subshell.
   shopt -s expand_aliases
   
   # patch the user variable if we were launched by one of our cron jobs.
index d8b44bc845aeaa7b2451473caabcb822bc1e83bb..c843dba6d20c4544bcd4438e67a889622e8da031 100644 (file)
@@ -9,8 +9,6 @@
 
 ##############
 
-#hmmm: moved from functions.sh; does that hose everything up?
-
   # defines a variable within the feisty meow environment and remembers that
   # this is a new or modified definition.  if the feisty meow codebase is
   # unloaded, then so are all the variables that were defined.
 return 0
   }
 
+  # switches from an X:/ form to a /cygdrive/X/path form.  this is only useful
+  # for the cygwin environment currently.
+  # defined here rather than in functions.sh since we need it when setting variables
+  # and cannot count on load order during a fresh startup in some circumstances.
+  function dos_to_unix_path() {
+    # we always remove dos slashes in favor of forward slashes.
+#old:    echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/\1\/\2/'
+         echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\([a-zA-Z]\):\/\(.*\)/\/cygdrive\/\1\/\2/'
+  }
+
+
 
 ##############