forked from matschaffer/profile
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit
More file actions
46 lines (36 loc) · 892 Bytes
/
init
File metadata and controls
46 lines (36 loc) · 892 Bytes
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
load_conf() {
local conf
for conf in "$1"/*.conf; do
[ -d "${conf}" ] && load_conf "${conf}"
[ -f "${conf}" ] && source "${conf}"
done
return 0
}
conf_support() {
cd `dirname ${BASH_ARGV[0]}`
echo "`pwd`/$1"
cd - > /dev/null
}
is_home_dir() {
cd "$1"
full_path=`pwd`
cd - > /dev/null
[ "$full_path" = "$HOME" ]
}
PROFILE_INIT=`readlink ${BASH_ARGV[0]}`
PROFILE_CORE=`dirname ${PROFILE_INIT}`
CONF_ENABLED="${PROFILE_CORE}/conf.enabled"
CONF_AVAILABLE="${PROFILE_CORE}/conf.available"
PLATFORM=`uname`
ORIGINAL_PWD=`pwd`
cd "${PROFILE_CORE}"
PROFILE_CORE=`pwd`
PLATFORM_ENABLED="${PROFILE_CORE}/${PLATFORM}/conf.enabled"
PLATFORM_AVAILABLE="${PROFILE_CORE}/${PLATFORM}/conf.available"
cd "${HOME}"
load_conf "${PROFILE_CORE}"
load_conf "${CONF_ENABLED}"
load_conf "${PLATFORM_ENABLED}"
cd "${ORIGINAL_PWD}"
# Export this for scripts
export PROFILE_CORE