fixed an oops where we had been expecting bash to convey our functions
[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 ##############
18
19 if [ -z "$FEISTY_MEOW_GENERATED" ]; then
20   # FEISTY_MEOW_GENERATED is where the generated files yeti uses are located.
21   # this is our single entry point we can use without knowing any variables
22   # yet in the initialization process.
23   export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen"
24 #hmmm: the above is kind of a constant.  that's not so great.
25
26   # make sure our main variables are established.
27   GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/fmc_variables.sh"
28   if [ ! -f "$GENERATED_FEISTY_MEOW_VARIABLES" ]; then
29     echo -e '\n\n'
30     echo "The yeti scripts need to be initialized via the bootstrap process, e.g.:"
31     echo "  bash $HOME/feisty_meow/scripts/core/bootstrap_shells.sh"
32     echo -e '\n\n'
33   fi
34
35   ##############
36
37   # pull in our generated variables that are the minimal set we need to find
38   # the rest of our resources.
39   source "$GENERATED_FEISTY_MEOW_VARIABLES"
40
41   # Set up the temporary directory.
42   source $FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh
43
44   ##############
45
46   # load the larger body of standard feisty meow variables into the environment.
47   source $FEISTY_MEOW_SCRIPTS/core/variables.sh
48
49 fi
50
51 ##############
52   
53 # include helpful functions.  we do this every time rather than making it part
54 # of variable initialization, because functions cannot be exported to
55 # sub-shells in bash (much like aliases cannot, to our infinite chagrin after
56 # having migrated from korn shell...).
57 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
58   
59 ##############
60   
61 # check hash table before searching path.
62 shopt -s checkhash
63 # don't check path for sourced files.
64 shopt -u sourcepath
65
66 ##############
67
68 if [ -z "$LIGHTWEIGHT_INIT" ]; then
69   # perform the bulkier parts of the login and initialization.
70
71   if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login begins...; fi
72
73   # set up the aliases for the shell, but only if they are not already set.
74   alias regenerated &>/dev/null  # see if a crucial alias exists.
75   if [ $? -ne 0 ]; then
76     if [ ! -z "$SHELL_DEBUG" ]; then
77       echo the aliases were missing, now they are added...
78     fi
79     source "$FEISTY_MEOW_GENERATED/fmc_core_and_custom_aliases.sh"
80   fi
81
82   # allow connections to our x server from the local host.
83   if [ ! -z "$DISPLAY" ]; then
84     if [ ! -z "$(echo "$OS_TYPE" | grep -i darwin)" ]; then
85       if [ ! -z "$SHELL_DEBUG" ]; then echo Enabling localhost X connections...; fi
86       xhost + localhost >/dev/null 2>&1
87     fi
88   fi
89
90   # a minor tickle of the title of the terminal, in case there is one.
91   bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh
92
93   if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login ends....; fi
94 fi
95