6b23579372dcdaebdbbbd99e72bd3f5b0422a818
[feisty_meow.git] / scripts / core / connect_feisty_meow.sh
1 #!/bin/bash
2
3 # Author: Chris Koeritz
4
5 # this script adds the feisty inits code to .bashrc, if we think it has not yet been added.
6
7 # auto-locate the feisty meow scripts, since they supposedly are not enabled yet.
8 export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )"  # obtain the script's working directory.
9 # normalize the path we want to cobble together.
10 export FEISTY_MEOW_APEX="$( \cd "$WORKDIR/../.." && \pwd )"
11
12 if [ -f "$HOME/.bashrc" ] && grep -q "launch_feisty_meow.sh" "$HOME/.bashrc"; then
13   # the stanza for loading feisty meow already seems to be present.
14   echo "Feisty Meow already seems to be configured in '~/.bashrc'."
15 else
16   # stuff the normal user init file into .bashrc.  not appropriate for root probably, but
17   # this is the easy quick start script for normal folks.
18   cat $FEISTY_MEOW_APEX/feisty_inits/dot.bashrc-normal-user |
19     sed -e \
20       "s? \$.*/scripts/core/launch_feisty? $FEISTY_MEOW_APEX/scripts/core/launch_feisty?" \
21       >> "$HOME/.bashrc"
22   echo "Feisty Meow is now configured in '~/.bashrc'."
23 fi
24