7c31837561e318990efd92011db280ff239e69cb
[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 # FEISTY_MEOW_GENERATED is where the generated files yeti uses are located.
20 # this is our single entry point we can use without knowing any variables
21 # yet in the initialization process.
22 export FEISTY_MEOW_GENERATED="$HOME/.zz_auto_gen"
23 if [ ! -z "$WINDIR" -o ! -z "$windir" ]; then
24   # assume they are using windoze.
25   export FEISTY_MEOW_GENERATED="$TMP/zz_auto_gen"
26 fi
27
28 # make sure our main variables are established.
29 GENERATED_FEISTY_MEOW_VARIABLES="$FEISTY_MEOW_GENERATED/feisty_meow_variables.sh"
30 if [ ! -f "$GENERATED_FEISTY_MEOW_VARIABLES" ]; then
31   echo -e '\n\n'
32   echo "The yeti scripts need to be initialized via the bootstrap process, e.g.:"
33   echo "  bash $HOME/feisty_meow/scripts/core/bootstrap_shells.sh"
34   echo -e '\n\n'
35 fi
36
37 # pull in our variable set.
38 source "$GENERATED_FEISTY_MEOW_VARIABLES"
39
40 ##############
41
42 # Set up all of the environment's system variables.  This is the first step
43 # in the majestic plan we have for this shell's initialization.
44 source $FEISTY_MEOW_SCRIPTS/core/variables.sh
45
46 # Set up the temporary directory...
47 source $FEISTY_MEOW_SCRIPTS/core/create_tempdir.sh
48
49 ##############
50
51 # check if this is dos/windows.
52 if [ "$OS" == "Windows_NT" ]; then
53   if [ -z "$HOME" ]; then
54     # set a default that might not be appropriate for everyone, but should
55     # still work.
56     export HOME=/c/home
57   fi
58   if [ ! -d "$HOME" ]; then mkdir $HOME; fi
59 fi
60
61 ##############
62
63 if [ -z "$LIGHTWEIGHT_INIT" ]; then
64   # perform the bulkier parts of the login and initialization.
65
66   if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login begins...; fi
67
68 #FEISTY_MEOW_GENERATED=$(echo $FEISTY_MEOW_GENERATED | sed -e 's/\\/\//g')
69 #FEISTY_MEOW_SCRIPTS="$(echo $FEISTY_MEOW_SCRIPTS | sed -e 's/\\/\//g')"
70 #FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS"
71
72   # set up the aliases for the shell, but only if they are not already set.
73   alias regenerated &>/dev/null  # see if a crucial alias exists.
74   if [ $? -ne 0 ]; then
75     if [ ! -z "$SHELL_DEBUG" ]; then
76       echo the aliases were missing, now they are added...
77     fi
78     source $FEISTY_MEOW_GENERATED/aliases.sh
79   fi
80
81   # allow connections to our x server from the local host.
82   if [ ! -z "$DISPLAY" ]; then
83     if [ ! -z "$(echo "$OS_TYPE" | grep -i darwin)" ]; then
84       if [ ! -z "$SHELL_DEBUG" ]; then echo Enabling localhost X connections...; fi
85       xhost + localhost >/dev/null 2>&1
86     fi
87   fi
88
89   # a minor tickle of the title of the terminal, in case there is one.
90   bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh
91
92   if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login ends....; fi
93 fi
94