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