-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.bash
51 lines (42 loc) · 1.1 KB
/
config.bash
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
#!/bin/bash
# Version 1.6
# for Ubuntu Server 14.04
# This will ensure your project is in working order on a Ubuntu system
# The intent is to git pull then run this
# If on dev you need to edit /etc/hosts
#check to ensure root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 11
fi
#Must be run from scripts dir!
scriptDir=${PWD}
#Get the domain name of the site we are working on
cd ..
domainName=${PWD##*/}
cd $scriptDir #back to start
#Ensure database user
cd ../sql
echo "Root Database Password:"
mysql -h localhost -u root -p < ../sql/config.sql
#Install Database
cd $scriptDir
bash update_db.bash
#Apache
cd ../apache
apacheDir=${PWD}
cd /etc/apache2/sites-available
ln -s $apacheDir/$domainName.conf $domainName.conf
a2ensite $domainName.conf
service apache2 reload
cd $scriptDir #back to start
#Permissions
cd ../
chown -R www-data:www-data public/
cd public
publicDir=${PWD}
chmod 755 $(find . -type d)
chmod 644 $(find . -type f)
cd $scriptDir #back to start
#Done
echo "All done your site ($domainName) should be up now, just edit /etc/hosts for local development."