From: Chris Koeritz Date: Sun, 12 Nov 2017 01:21:00 +0000 (-0500) Subject: nice mod to support connecting root also X-Git-Tag: 2.140.98^2~30^2~5 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=f8348e7201809d534dd773e37091d8b9b20d455f;p=feisty_meow.git nice mod to support connecting root also now the root user can run the connect feisty meow process on its own startup file, by providing the --root flag to the connect_feisty_meow script. this is important, since it is never recommended to load a big scripting environment for root by default. too much depends on root's commands being exactly what they seem, rather than having been aliased. anyway, the root user can run fredme or feistyme to load up the script environment. --- 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/connect_feisty_meow.sh b/scripts/core/connect_feisty_meow.sh index 9a5c81d5..30d89887 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'." + 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'." + fi fi