6 # Defines the environment variables used by the personalized unix
8 # Author: Chris Koeritz
12 # this section should always run or bash will reset them on us.
13 # these need to be as minimal as possible.
15 # sets the main prompt to a simple default, with user@host.
16 export PS1='\u@\h $ ';
17 # sets the history length and max file size so we can get some long history around here.
18 export HISTSIZE=1000000
19 export HISTFILESIZE=2000000
23 # we'll run this again only if we think it's needed.
24 if [ -z "$NECHUNG" ]; then
26 if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization begins...; fi
30 # start with some simpler things.
32 export SCRIPT_SYSTEM=feisty_meow
34 # OS variable records the operating system we think we found.
38 export IS_DARWIN=$(echo $OSTYPE | grep -i darwin)
42 # guess the current platform.
43 IS_UNIX=$(uname | grep -i linux)
44 if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i unix); fi
45 if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i darwin); fi
46 IS_DOS=$(uname | grep -i ming)
47 if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi
49 # now if we're stuck in DOS, try to determine the type of system.
50 if [ ! -z "$IS_DOS" ]; then
51 # IS_MSYS will be non-empty if this is the msys toolset. otherwise
52 # we assume that it's cygwin.
53 IS_MSYS=$(uname | grep -i ming)
58 # fallbacks to set crucial variables for feisty meow...
60 # set the main root directory variable for the feisty meow codebase.
61 # this is only used for extreme failure modes, when the values were not
62 # pulled in from our auto-generated config.
63 if [ -z "$FEISTY_MEOW_DIR" ]; then
64 if [ -d "$HOME/feisty_meow" ]; then
65 export FEISTY_MEOW_DIR="$HOME/feisty_meow"
66 export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS"
70 # similarly, make sure we have someplace to look for our generated files, if
71 # we were not handed a value.
72 if [ -z "$FEISTY_MEOW_GENERATED" ]; then
73 # The generated scripts directory is where automatically generated files live.
74 # It is separate from the main body of the shell scripts in order to keep things from
76 export FEISTY_MEOW_GENERATED=$HOME/.zz_auto_gen
81 # umask sets a permission mask for all file creations. the mask used here
82 # disallows writing by the "group" and "others" categories.
84 # ulimit sets user limits. we set the maximum allowed core dump file size
85 # to zero, because it is obnoxious to see the core dumps from crashed
86 # programs lying around everywhere.
91 # user variables, sort of... if they haven't given themselves a name yet,
92 # then we will make one up for them.
94 # define a default name, if one wasn't already set.
95 if [ -z "$NAME" ]; then
96 export NAME='Unset Q. Namington, Fixley Your Name III'
101 # variables for perl.
104 if [ "$OS" != "Windows_NT" ]; then
105 PERLLIB+="/usr/lib/perl5"
107 export PERLIO=:perlio
108 # choose perl's IO over the ms-windows version so we can handle file
112 # iterate across our sub-directories and find the perl scripts.
113 # this currently only looks one level down.
114 for i in $FEISTY_MEOW_SCRIPTS/*; do
116 # check if there is a perl file present; add the folder to PERLLIB if so.
117 ls $i/*.pl &>/dev/null
118 if [ $? -eq 0 ]; then
123 #echo PERLLIB is now $PERLLIB
127 # set this so nechung can find its data.
128 export NECHUNG=$FEISTY_MEOW_DIR/database/fortunes.dat
130 # ensure we use the right kind of secure shell.
131 export CVS_RSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh
132 export GIT_SSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh
134 # the base checkout list is just to update feisty_meow. additional folder
135 # names can be added in your customized scripts.
136 export REPOSITORY_LIST="feisty_meow"
138 # initializes the feisty meow build variables, if possible.
139 function initialize_build_variables()
142 # we need to know the feisty meow directory, or we bail.
143 if [ -z "$FEISTY_MEOW_DIR" ]; then return; fi
144 # pick from our expected generator folder, but make sure it's there...
145 buildvars="$FEISTY_MEOW_SCRIPTS/generator/build_variables.sh"
146 if [ -f "$buildvars" ]; then
147 # yep, that one looks good, so pull in the build defs.
148 source "$buildvars" "$buildvars"
151 # now augment the environment if we found our build variables.
152 if [ $found_build_vars == 1 ]; then
153 # the binary directory contains handy programs we use a lot. we set
154 # up the path to it here based on the operating system.
155 export BINDIR=$FEISTY_MEOW_DIR/production/binaries
156 # add binaries created within build to the path.
157 export PATH="$BINDIR:$PATH"
158 # Shared libraries are located via this variable.
159 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BINDIR"
165 # windoze specific patching up missing things.
167 if [ "$OS" == "Windows_NT" ]; then
168 export HOSTNAME=$(echo $HOSTNAME | tr A-Z a-z)
173 # load in the build environment.
174 initialize_build_variables
178 # add to the PATH variables used for locating applications. this step is taken after any
179 # potential overrides from the user.
180 export PATH="$FEISTY_MEOW_GENERATED:$PATH:$(find /usr/local/games -maxdepth 1 -type d -exec echo -n {}: ';' 2>/dev/null)/sbin"
184 # set the SHUNIT_DIR so our shunit tests can find the codebase.
185 export SHUNIT_DIR="$FEISTY_MEOW_SCRIPTS/shunit"
189 if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization ends....; fi
195 # pull in the custom overrides for feisty_meow scripts. this is done last,
196 # because we want to set everything up as expected, then let the user
197 # override individual variables and definitions. we also don't guard this
198 # to avoid running it again, because we don't know what mix of functions and
199 # aliases they want to define in there.
200 for i in $FEISTY_MEOW_GENERATED/custom/*.sh; do
201 if [ ! -f "$i" ]; then
202 # skip it if it's not real.
205 if [ ! -z "$SHELL_DEBUG" ]; then
206 echo "loading customization: $(basename $(dirname $i))/$(basename $i)"