forked from Bernie-2016/ground-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-osx
executable file
·42 lines (33 loc) · 1.07 KB
/
setup-osx
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
#!/bin/bash
echo "Installing PostgreSQL..."
brew install postgres
echo "Installing Postgis..."
brew install postgis
/usr/local/bin/pg_isready >/dev/null
if [ $? -ne 0 ]; then
echo "Starting up database..."
/usr/local/bin/pg_ctl -D /usr/local/var/postgres start
sleep 2
fi
/usr/local/bin/dropdb ground_control
if [ $? -ne 0 ]; then
echo "dropdb did not run. This is probably because the database does not already exist, which is fine."
fi
/usr/local/bin/createdb ground_control
if [ $? -ne 0 ]; then
echo "createdb did not run. This is probably because the database already exists, which is fine."
fi
/usr/local/bin/psql -c "CREATE ROLE ground_control WITH LOGIN SUPERUSER;" -d ground_control
if [ $? -ne 0 ]; then
echo "ground_control role not created. This is probably because the role already exists, which is fine."
fi
/usr/local/bin/psql -c "CREATE EXTENSION postgis;" -d ground_control
if [ $? -ne 0 ]; then
echo "PostGIS already installed"
fi
echo "Seeding data..."
npm run migrate
npm run seed
/usr/local/bin/pg_ctl -D /usr/local/var/postgres stop
sleep 2
echo "Done!"