-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv
More file actions
executable file
·60 lines (50 loc) · 1.41 KB
/
env
File metadata and controls
executable file
·60 lines (50 loc) · 1.41 KB
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
#!/bin/bash
if [[ -e ./bits/bootstrap/logging ]]; then
source ./bits/bootstrap/logging
else
source logging
fi
if [[ `uname` == "Darwin" ]]; then
export OS=mac
export SED_I="sed -i .deleteme"
elif [[ "`lsb_release -d | grep Ubuntu`" != "" ]]; then
export OS=ubuntu
export SED_I="sed -i"
elif [[ "`lsb_release -d | grep Mint`" != "" ]]; then
export OS=ubuntu
export SED_I="sed -i"
elif [[ "`lsb_release -d | grep \"Red Hat\"`" != "" ]]; then
export OS=redhat
export SED_I="sed -i"
elif [[ "`lsb_release -d | grep \"CentOS\"`" != "" ]]; then
export OS=centos
export SED_I="sed -i"
else
export OS=unknown
export SED_I="sed -i"
fi
if [[ "$USER" == root ]]; then
debug "Clearing SUDO environment variable. (running as root already)"
export SUDO=""
else
debug "Setting SUDO environment variable. (running as $USER)"
export SUDO=sudo
fi
debug "Exporting \$OS=$OS"
ENV=${ENV-ignore}
if [[ -e "./assets/env/default" ]]; then
debug "Including default variables in ./assets/env/default"
. ./assets/env/default
fi
if [[ -e "./assets/env/$OS" ]]; then
debug "Including OS variables in ./assets/env/$OS"
. ./assets/env/$OS
fi
if [[ -e "./assets/env/`hostname`" ]]; then
debug "Including HOST variables in ./assets/env/`hostname`"
. ./assets/env/`hostname`
fi
if [[ "$ENV" != "ignore" ]] && [[ -e "./assets/env/$ENV" ]]; then
debug "Including ENV variables in ./assets/env/$ENV"
. ./assets/env/$ENV
fi