-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.sh
executable file
·76 lines (59 loc) · 1.46 KB
/
init.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
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
73
74
75
76
#!/bin/bash
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
. "$DIR/common.sh"
## Script
echo -e "${NC}Changing into ${DIR}"
cd ${DIR}
echo
echo -e "${ORANGE}=== Checking Dependencies ==="
echo
echo -e "${NC}Checking for vagrant"
if exists vagrant; then
echo -e "${GREEN}vagrant found."
else
missing vagrant
fi
echo -e "${NC}Checking for ansible"
if exists ansible; then
echo -e "${GREEN}ansible found."
else
missing ansible
fi
echo
echo -e "${GREEN}All dependencies installed"
echo
echo -e "${ORANGE}=== Checking .env ==="
echo
if [ -f "../.env" ]
then
echo -e "${GREEN}'../.env' found"
else
echo -e "${ORANGE}'../.env' not found"
echo -e "${ORANGE}Copying the sample-file to '../.env'"
echo
echo -e "${RED}Before continuing you should customize '../.env'"
echo
cp .env.example ../.env
fi
echo
echo -e "${GREEN}All checks passed"
echo
read -p "Do you want to set up your local server now? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "${NC}Starting 'setup-local.sh' installation script"
./setup-local.sh
else
echo -e "${ORANGE}User aborted"
echo -e "${NC}Please manually run 'setup-local.sh' to set up your local server."
fi
echo
echo -e "${GREEN}=== Done ==="
echo
echo -e "${NC}You finished the initialization."
echo
echo -e "${NC}Use 'vagrant ssh' inside '${DIR}' or one of the following scripts from this directory to operate on the machine: "
echo "$(ls ./*.sh | egrep -v '(common|init).sh')"
exit 0