-
Notifications
You must be signed in to change notification settings - Fork 3
/
loader
executable file
·72 lines (59 loc) · 1.89 KB
/
loader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Exit if running non-interacive or not bash at all
if [[ $- != *i* ]] || [ -z "$PS1" ] || [ -z "${BASH_VERSION}" ]; then
return
fi
mydir=$(cd $(dirname ${BASH_SOURCE:-$0});pwd)
os=$(uname -s)
bash_version=${BASH_VERSION%.*}
int_ninjab_available_parts=''
. ${mydir}/functions
. ${mydir}/config
if [ -f /etc/ninjab.conf ]; then
. /etc/ninjab.conf
fi
if [ -f ${mydir}/config.local ]; then
. ${mydir}/config.local
fi
if [ -f ~/.ninjab.conf ]; then
. ~/.ninjab.conf
fi
if [ -f /etc/ninjab_ask -o -f ~/.ninjab_ask ]; then
if ! int_ninjab_yesno --charcount 1 --default yes "${ninjab_ask_text:-"Do you want to load more usefull bash configurations?"} [Yn]"; then
return
fi
fi
if [ ! -z $load_global_bashrc ]; then
if [ -f /etc/bashrc ]; then
[ ${startup_debug} ] && echo -n "Loading global /etc/bashrc" ||:
. /etc/bashrc
[ ${startup_debug} ] && echo " - done" ||:
fi
fi
if [ ! -z $load_global_bash_completion ]; then
if [ -f /etc/bash_completion ]; then
[ ${startup_debug} ] && echo -n "Loading global /etc/bash_completion" ||:
. /etc/bash_completion
[ ${startup_debug} ] && echo " - done" ||:
fi
if [ -f /opt/local/etc/bash_completion ]; then
[ ${startup_debug} ] && echo -n "Loading global /opt/local/etc/bash_completion" ||:
. /opt/local/etc/bash_completion
[ ${startup_debug} ] && echo " - done" ||:
fi
if which brew &> /dev/null; then
if [ -f $(brew --prefix)/etc/bash_completion ]; then
[ ${startup_debug} ] && echo -n "Loading brew installed bash_completion" ||:
. $(brew --prefix)/etc/bash_completion
[ ${startup_debug} ] && echo " - done" ||:
fi
fi
fi
for i in $mydir/parts/*; do
# Load every file as long as they dont have a # ~ in the filename
if ! [[ $i =~ \#|~ ]]; then
[ ${startup_debug} ] && echo -en "\nPart ${i} -" ||:
. $i
[ ${startup_debug} ] && echo "End of part ${i}" ||:
fi
done