5 # Fred Hamster's Feisty Meow Concerns Ltd. Startup Profile.
7 # This file is useful within .profile or other initialization scripts.
9 # Author: Chris Koeritz
13 # DEBUG_FEISTY_MEOW: if this variable is non-empty, then it causes the feisty meow
14 # scripts to print more diagnostic information when they run. not all
15 # scripts support this, but the core ones do.
17 #export DEBUG_FEISTY_MEOW=true
21 # some preconditions we want to establish before loading anything...
23 # make sure that aliases can be used in non-interactive shells.
24 shopt -s expand_aliases
26 # patch the user variable if we were launched by one of our cron jobs.
27 if [ -z "$USER" -a ! -z "$CRONUSER" ]; then
28 export USER="$CRONUSER"
33 export ERROR_OCCURRED=
34 # there have been no errors to start with, at least. we will set this
35 # to non-empty if something bad happens.
37 if [ -z "$FEISTY_MEOW_LOADING_DOCK" ]; then
38 # FEISTY_MEOW_LOADING_DOCK is where the generated files are located.
39 # this is our single entry point we can use without knowing any variables
40 # yet in the initialization process.
41 export FEISTY_MEOW_LOADING_DOCK="$HOME/.zz_feisty_loading"
42 #hmmm: the above is kind of a constant. that's not so great.
44 # make sure our main variables are established.
45 FEISTY_MEOW_VARIABLES_LOADING_FILE="$FEISTY_MEOW_LOADING_DOCK/fmc_variables.sh"
46 if [ ! -f "$FEISTY_MEOW_VARIABLES_LOADING_FILE" ]; then
48 example_dir="/usr/local/fred"
50 The feisty meow scripts need initialization via the bootstrap process. For\n\
51 example, if the feisty meow folder lives in '$example_dir', then this\n\
52 command bootstraps feisty meow:\n\
54 bash $example_dir/feisty_meow/scripts/core/reconfigure_feisty_meow.sh\n\
62 if [ -z "$ERROR_OCCURRED" ]; then
64 # pull in our generated variables that are the minimal set we need to find
65 # the rest of our resources.
66 source "$FEISTY_MEOW_VARIABLES_LOADING_FILE"
68 # Set up the temporary directory.
69 source "$FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh"
76 if [ -z "$ERROR_OCCURRED" ]; then
78 # load the larger body of standard feisty meow variables into the environment.
79 # we actually want this to always run also; it will decide what variables need
81 source "$FEISTY_MEOW_SCRIPTS/core/variables.sh"
85 # include helpful functions. we do this every time rather than making it part
86 # of variable initialization, because functions cannot be exported to
88 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
90 # load some helper methods for the terminal which we'll use below.
91 source "$FEISTY_MEOW_SCRIPTS/tty/terminal_titler.sh"
95 # check hash table before searching path.
97 # don't check path for sourced files.
99 # ignore duplicate lines.
100 HISTCONTROL=ignoredups
101 # append to the history file.
103 # automatically update window size if needed.
104 shopt -s checkwinsize
108 # make history writes immediate to avoid losing history if bash is zapped.
109 echo $PROMPT_COMMAND | grep -q history
110 if [ $? -ne 0 ]; then
111 # we only change the prompt command if we think it hasn't already been done.
112 export PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
117 # perform the bulkier parts of the initialization process.
119 if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init begins..."; fi
121 # set up the aliases for the shell, but only if they are not already set.
122 type CORE_ALIASES_LOADED &>/dev/null
123 if [ $? -ne 0 ]; then
124 if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then
125 echo "the aliases were missing, now they are being added..."
127 source "$FEISTY_MEOW_LOADING_DOCK/fmc_core_and_custom_aliases.sh"
130 #echo before the new labelling, terminal titles have:
131 #show_terminal_titles
133 # a minor tickle of the title of the terminal, unless we already have some history.
134 label_terminal_with_info
136 if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then echo "heavyweight init is done."; fi
138 if [ -z "$ERROR_OCCURRED" ]; then
139 # set a sentinel variable to say we loaded the feisty meow environment.
140 export FEISTY_MEOW_SCRIPTS_LOADED=true
143 fi # no error occurred.