-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·30 lines (21 loc) · 870 Bytes
/
start.sh
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
#!/bin/sh
source ~/.environments/functions.sh
setup_environment () {
# get current location
LOCATION=$(networksetup -getcurrentlocation | tr '[:upper:]' '[:lower:]')
# get service for default route
SERVICE_GUID=$(printf "open\nget State:/Network/Global/IPv4\nd.show" | scutil | awk '/PrimaryService/ { print $3}')
# get service name for guid
SERVICE_NAME=$(printf "open\nget Setup:/Network/Service/${SERVICE_GUID}\nd.show" | scutil | awk -F': ' '/UserDefinedName/ {print $2}')
if [[ -d "$HOME/.environments/$LOCATION" ]]; then
bot "Welcome to environment: ${GREEN}$LOCATION${NC}"
task "Executing common.sh"
include ~/.environments/common.sh
for file in $(find ~/.environments/${LOCATION} -type f -name "*.sh"); do
task "Executing $(basename ${file})"
include ${file}
done
fi
bot "All done."
}
setup_environment