-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_project.sh
More file actions
executable file
·132 lines (112 loc) · 3.4 KB
/
new_project.sh
File metadata and controls
executable file
·132 lines (112 loc) · 3.4 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
part_dir=/var/www/partners
makes_dir=/home/ideath/makes
def_make=awd_default.make
gitignore=/home/ideath/drupal/.gitignore
git_repos=/home/git/repositories
if [ ${#} -eq 0 ]; then
echo Input PARTNER, PROJECT, MAKEFILE
exit 1
fi
if [ ! -d "${part_dir}/${1}" ]; then
echo Partner doesn\'t exists. Please create directory for him.
exit 1
fi
echo Partner: ${1}
if [ -d "${part_dir}/${1}/${1}_${2}" ]; then
echo This project has been created. Nothing to do...
exit 1
fi
echo Project: ${2}
if [ -z "${3}" ]; then
if [ -f "${makes_dir}/${3}" ]; then
def_make="${3}"
echo Using Make: ${def_make}
fi
fi
echo Using Make: ${def_make}
echo Creating dirs...
mkdir ${part_dir}/${1}/${1}_${2}
proj_dir=${part_dir}/${1}/${1}_${2}
#mkdir ${proj_dir}/repository
mkdir ${proj_dir}/backups
mkdir ${proj_dir}/develop
mkdir ${proj_dir}/scripts
mkdir ${proj_dir}/temp
mkdir ${proj_dir}/logs
touch ${proj_dir}/logs/error.log
cd ${proj_dir}/develop
echo In Develop
echo Installing drupal
#drush dl --drupal-project-rename=develop -y
cp ${makes_dir}/${def_make} ./
drush make ${def_make} -y #-v
drush cc all
drush site-install minimal --db-url=mysql://${1}:${1}dbpass@localhost/${1}_${2} --account-pass=testpass -y
echo "drush si minimal --db-url=mysql://${1}:${1}dbpass/${1}_${2} -y"
cp -f ${gitignore} ./
git init
git add .
git commit -a -m "Init"
git branch develop
git config merge.ff false #disabling fast-forward
mv .git ../repository
echo Moving ./.git to ../repository
cd ..
echo Creating simlink ${git_repos}/${1}_${2}.git on ${proj_dir}/repository
ln -s ${proj_dir}/repository ${git_repos}/${1}_${2}.git
echo Crating Vhost
touch vhost.conf
echo "
<VirtualHost *:80>
#ServerAdmin webmaster@localhost
ServerName ${2}.dev${1}.altwd.com
DocumentRoot ${proj_dir}/develop/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory ${proj_dir}/develop/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
#ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#<Directory /usr/lib/cgi-bin>
# AllowOverride None
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Order allow,deny
# Allow from all
#</Directory>
ErrorLog ${proj_dir}/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog ${proj_dir}/logs/access.log combined
</VirtualHost>
" > vhost.conf
echo In project folder
ln -s ${proj_dir}/vhost.conf /etc/apache2/sites-enabled/${1}_${2}
echo Server restarting
service apache2 restart
service mysql reload
echo Create config file
touch ${proj_dir}/scripts/config.sh
echo "#!/bin/bash
PROJECT_DIR=${proj_dir}
PROJECT_NAME=${2}
PARTNER=${1}
ENVIRONMENTS=( develop )
#end" > ${proj_dir}/scripts/config.sh
echo Copying files...
cp /home/ideath/scripts/develop_deploy.sh ${proj_dir}/scripts/
cp /home/ideath/scripts/post-update ${proj_dir}/repository/hooks/
#wget --directory-prefix=${proj_dir} http://raw.github...
echo Permissions...
chown -R ideath ${proj_dir}
chgrp -R awd ${proj_dir}
echo Setting permisions to ${proj_dir}/repository
chown -R git ${proj_dir}/repository
chgrp -R git ${proj_dir}/repository
echo Project has been created successfully