added some nice shell options to startup script. added in new script to parse
[feisty_meow.git] / scripts / core / launch_feisty_meow.sh
1 #!/bin/bash
2
3 ##############
4
5 # Fred Hamster's Feisty Meow Concerns Ltd. Startup Profile.
6 #
7 # This file is useful within .profile or other initialization scripts.
8 #
9 # Author: Chris Koeritz
10
11 ##############
12
13 #export SHELL_DEBUG=true
14   # this variable causes the scripts that listen to it to print more information
15   # when they run.
16
17 export ERROR_OCCURRED=
18   # no error to start with.
19
20 ##############
21
22 if [ -z "$FEISTY_MEOW_GENERATED" ]; then
23   # FEISTY_MEOW_GENERATED is where the generated files yeti uses are located.
24   # this is our single entry point we can use without knowing any variables
25   # yet in the initialization process.
26   export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen"
27 #hmmm: the above is kind of a constant.  that's not so great.
28
29   # make sure our main variables are established.
30   GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/fmc_variables.sh"
31   if [ ! -f "$GENERATED_FEISTY_MEOW_VARIABLES" ]; then
32     echo -e '\n\n'
33     echo "The yeti scripts need to be initialized via the bootstrap process, e.g.:"
34     echo "  bash $HOME/feisty_meow/scripts/core/bootstrap_shells.sh"
35     echo -e '\n\n'
36     ERROR_OCCURRED=true
37   fi
38
39   ##############
40
41   # pull in our generated variables that are the minimal set we need to find
42   # the rest of our resources.
43   source "$GENERATED_FEISTY_MEOW_VARIABLES"
44
45   # Set up the temporary directory.
46   source $FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh
47
48 fi
49
50 ##############
51
52 # load the larger body of standard feisty meow variables into the environment.
53 # we actually want this to always run also; it will decide what variables need
54 # to be set again.
55 source $FEISTY_MEOW_SCRIPTS/core/variables.sh
56
57 ##############
58   
59 # include helpful functions.  we do this every time rather than making it part
60 # of variable initialization, because functions cannot be exported to
61 # sub-shells in bash (much like aliases cannot, to our infinite chagrin after
62 # having migrated from korn shell...).
63 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
64   
65 ##############
66   
67 # check hash table before searching path.
68 shopt -s checkhash
69 # don't check path for sourced files.
70 shopt -u sourcepath
71 # ignore duplicate lines and spaces for history.
72 HISTCONTROL=ignoredups:ignorespace
73 # append to the history file.
74 shopt -s histappend
75 # automatically update window size if needed.
76 shopt -s checkwinsize
77
78 ##############
79
80 if [ -z "$LIGHTWEIGHT_INIT" ]; then
81   # perform the bulkier parts of the login and initialization.
82
83   if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login begins...; fi
84
85   # set up the aliases for the shell, but only if they are not already set.
86   alias regenerate &>/dev/null  # see if a crucial alias exists.
87   if [ $? -ne 0 ]; then
88     if [ ! -z "$SHELL_DEBUG" ]; then
89       echo the aliases were missing, now they are added...
90     fi
91     source "$FEISTY_MEOW_GENERATED/fmc_core_and_custom_aliases.sh"
92   fi
93
94   # allow connections to our x server from the local host.
95   if [ ! -z "$DISPLAY" ]; then
96     if [ ! -z "$(echo "$OS_TYPE" | grep -i darwin)" ]; then
97       if [ ! -z "$SHELL_DEBUG" ]; then echo Enabling localhost X connections...; fi
98       xhost + localhost >/dev/null 2>&1
99     fi
100   fi
101
102   # a minor tickle of the title of the terminal, in case there is one.
103   bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh
104
105   if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login ends....; fi
106 fi
107
108 if [ -z "$ERROR_OCCURRED" ]; then
109   # set a sentinel variable to say we loaded the feisty meow environment.
110   export FEISTY_MEOW_SCRIPTS_LOADED=true
111 fi
112