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=8000000
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.
82 # this mask disallows writes by "group" and "others".
84 # this mask disallows writes by the "group" and disallows "others" completely.
87 # ulimit sets user limits. we set the maximum allowed core dump file size
88 # to zero, because it is obnoxious to see the core dumps from crashed
89 # programs lying around everywhere.
94 # user variables, sort of... if they haven't given themselves a name yet,
95 # then we will make one up for them.
97 # define a default name, if one wasn't already set.
98 if [ -z "$NAME" ]; then
99 export NAME='Unset Q. Namington, Fixley Your Name III'
104 # variables for perl.
106 export PERLLIB+="/usr/lib/perl5"
107 if [ "$OS" == "Windows_NT" ]; then
108 export PERLIO=:perlio
109 # choose perl's IO over the ms-windows version so we can handle file
113 # iterate across our sub-directories and find the perl scripts.
114 # this currently only looks one level down.
115 for i in $FEISTY_MEOW_SCRIPTS/*; do
117 # check if there is a perl file present; add the folder to PERLLIB if so.
118 ls $i/*.pl &>/dev/null
119 if [ $? -eq 0 ]; then
120 PERLLIB+=":$(dos_to_unix_path $i)"
124 #echo PERLLIB is now $PERLLIB
128 # set this so nechung can find its data.
129 export NECHUNG=$FEISTY_MEOW_DIR/infobase/fortunes.dat
131 # ensure we use the right kind of secure shell.
132 # export CVS_RSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh
133 # export GIT_SSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh
135 # the base checkout list is just to update feisty_meow. additional folder
136 # names can be added in your customized scripts. the space at the end of
137 # this variable is important and allows users to extend the list like:
138 # export REPOSITORY_DIR+="muppets configs"
139 export REPOSITORY_LIST="feisty_meow "
141 # initializes the feisty meow build variables, if possible.
142 function initialize_build_variables()
145 # we need to know the feisty meow directory, or we bail.
146 if [ -z "$FEISTY_MEOW_DIR" ]; then return; fi
147 # pick from our expected generator folder, but make sure it's there...
148 buildvars="$FEISTY_MEOW_SCRIPTS/generator/build_variables.sh"
149 if [ -f "$buildvars" ]; then
150 # yep, that one looks good, so pull in the build defs.
151 source "$buildvars" "$buildvars"
154 # now augment the environment if we found our build variables.
155 if [ $found_build_vars == 1 ]; then
156 # the binary directory contains handy programs we use a lot. we set
157 # up the path to it here based on the operating system.
158 export BINDIR=$FEISTY_MEOW_DIR/production/binaries
159 # add binaries created within build to the path.
160 export PATH="$(dos_to_unix_path $BINDIR):$PATH"
161 # Shared libraries are located via this variable.
162 export LD_LIBRARY_PATH="$(dos_to_unix_path $LD_LIBRARY_PATH):$(dos_to_unix_path $BINDIR)"
168 # windoze specific patching up missing things.
170 if [ "$OS" == "Windows_NT" ]; then
171 export HOSTNAME=$(echo $HOSTNAME | tr A-Z a-z)
176 # load in the build environment.
177 initialize_build_variables
181 # add to the PATH variables used for locating applications. this step is taken after any
182 # potential overrides from the user.
183 export PATH="$(dos_to_unix_path $FEISTY_MEOW_GENERATED):$PATH:$(find /usr/local/games -maxdepth 1 -type d -exec echo -n {}: ';' 2>/dev/null)/sbin"
187 # set the SHUNIT_DIR so our shunit tests can find the codebase.
188 export SHUNIT_DIR="$FEISTY_MEOW_SCRIPTS/shunit"
192 if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization ends....; fi
198 # pull in the custom overrides for feisty_meow scripts. this is done last,
199 # because we want to set everything up as expected, then let the user
200 # override individual variables and definitions. we also don't guard this
201 # to avoid running it again, because we don't know what mix of functions and
202 # aliases they want to define in there.
203 for i in $FEISTY_MEOW_GENERATED/custom/*.sh; do
204 if [ ! -f "$i" ]; then
205 # skip it if it's not real.
208 if [ ! -z "$SHELL_DEBUG" ]; then
209 echo "loading customization: $(basename $(dirname $i))/$(basename $i)"