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
21 # make the TERM available to all sub-shells.
26 # we'll run this again only if we think it's needed.
27 if [ -z "$NECHUNG" ]; then
29 if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization begins...; fi
33 # start with some simpler things.
35 export SCRIPT_SYSTEM=feisty_meow
37 # OS variable records the operating system we think we found.
41 export IS_DARWIN=$(echo $OSTYPE | grep -i darwin)
45 # guess the current platform.
46 IS_UNIX=$(uname | grep -i linux)
47 if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i unix); fi
48 if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i darwin); fi
49 IS_DOS=$(uname | grep -i ming)
50 if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi
52 # now if we're stuck in DOS, try to determine the type of system.
53 if [ ! -z "$IS_DOS" ]; then
54 # IS_MSYS will be non-empty if this is the msys toolset. otherwise
55 # we assume that it's cygwin.
56 IS_MSYS=$(uname | grep -i ming)
61 # fallbacks to set crucial variables for feisty meow...
63 # set the main root directory variable for the feisty meow codebase.
64 # this is only used for extreme failure modes, when the values were not
65 # pulled in from our auto-generated config.
66 if [ -z "$FEISTY_MEOW_DIR" ]; then
67 if [ -d "$HOME/feisty_meow" ]; then
68 export FEISTY_MEOW_DIR="$HOME/feisty_meow"
69 export FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS"
73 # similarly, make sure we have someplace to look for our generated files, if
74 # we were not handed a value.
75 if [ -z "$FEISTY_MEOW_GENERATED" ]; then
76 # The generated scripts directory is where automatically generated files live.
77 # It is separate from the main body of the shell scripts in order to keep things from
79 export FEISTY_MEOW_GENERATED=$HOME/.zz_auto_gen
84 # umask sets a permission mask for all file creations.
85 # this mask disallows writes by "group" and "others".
87 # this mask disallows writes by the "group" and disallows "others" completely.
90 # ulimit sets user limits. we set the maximum allowed core dump file size
91 # to zero, because it is obnoxious to see the core dumps from crashed
92 # programs lying around everywhere.
97 # user variables, sort of... if they haven't given themselves a name yet,
98 # then we will make one up for them.
100 # define a default name, if one wasn't already set.
101 if [ -z "$NAME" ]; then
102 export NAME='Unset Q. Namington, Fixley Your Name III'
107 # variables for perl.
109 export PERLLIB+="/usr/lib/perl5"
110 if [ "$OS" == "Windows_NT" ]; then
111 export PERLIO=:perlio
112 # choose perl's IO over the ms-windows version so we can handle file
116 # iterate across our sub-directories and find the perl scripts.
117 # this currently only looks one level down.
118 for i in $FEISTY_MEOW_SCRIPTS/*; do
120 # check if there is a perl file present; add the folder to PERLLIB if so.
121 ls $i/*.pl &>/dev/null
122 if [ $? -eq 0 ]; then
123 PERLLIB+=":$(dos_to_unix_path $i)"
127 #echo PERLLIB is now $PERLLIB
131 # set this so nechung can find its data.
132 export NECHUNG=$FEISTY_MEOW_DIR/infobase/fortunes.dat
134 # ensure we use the right kind of secure shell.
135 # export CVS_RSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh
136 # export GIT_SSH=$FEISTY_MEOW_SCRIPTS/security/ssh.sh
138 # the base checkout list is just to update feisty_meow. additional folder
139 # names can be added in your customized scripts. the space at the end of
140 # this variable is important and allows users to extend the list like:
141 # export REPOSITORY_DIR+="muppets configs"
142 export REPOSITORY_LIST="feisty_meow "
144 # initializes the feisty meow build variables, if possible.
145 function initialize_build_variables()
148 # we need to know the feisty meow directory, or we bail.
149 if [ -z "$FEISTY_MEOW_DIR" ]; then return; fi
150 # pick from our expected generator folder, but make sure it's there...
151 buildvars="$FEISTY_MEOW_SCRIPTS/generator/build_variables.sh"
152 if [ -f "$buildvars" ]; then
153 # yep, that one looks good, so pull in the build defs.
154 source "$buildvars" "$buildvars"
157 # now augment the environment if we found our build variables.
158 if [ $found_build_vars == 1 ]; then
159 # the binary directory contains handy programs we use a lot. we set
160 # up the path to it here based on the operating system.
161 export BINDIR=$FEISTY_MEOW_DIR/production/binaries
162 # add binaries created within build to the path.
163 export PATH="$(dos_to_unix_path $BINDIR):$PATH"
164 # Shared libraries are located via this variable.
165 export LD_LIBRARY_PATH="$(dos_to_unix_path $LD_LIBRARY_PATH):$(dos_to_unix_path $BINDIR)"
171 # windoze specific patching up missing things.
173 if [ "$OS" == "Windows_NT" ]; then
174 export HOSTNAME=$(echo $HOSTNAME | tr A-Z a-z)
179 # load in the build environment.
180 initialize_build_variables
184 # add to the PATH variables used for locating applications. this step is taken after any
185 # potential overrides from the user.
186 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"
190 # set the SHUNIT_DIR so our shunit tests can find the codebase.
191 export SHUNIT_DIR="$FEISTY_MEOW_SCRIPTS/shunit"
195 if [ ! -z "$SHELL_DEBUG" ]; then echo variables initialization ends....; fi
200 # pull in the custom overrides for feisty_meow scripts. this is done last,
201 # because we want to set everything up as expected, then let the user
202 # override individual variables and definitions. we also don't guard this
203 # to avoid running it again, because we don't know what mix of functions and
204 # aliases they want to define in there.
205 for i in $FEISTY_MEOW_GENERATED/custom/*.sh; do
206 if [ ! -f "$i" ]; then
207 # skip it if it's not real.
210 if [ ! -z "$SHELL_DEBUG" ]; then
211 echo "loading customization: $(basename $(dirname $i))/$(basename $i)"