-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·63 lines (56 loc) · 1.75 KB
/
install.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
#!/bin/bash
#Usage : ./install.sh -a test -p test -c core -v 1.3 -i
DEFAULT_INDEX_URL="https://raw.github.com/guyoun/waffle/master/default/index.php-1.3"
CAKEPHP_REPOSITORY="https://github.com/cakephp/cakephp.git"
project="default_project"
cakephp_core="cakephp_core"
cakephp_ver="1.3"
app="default_app"
command="install"
set -- $(getopt -u -o iuc:v:p:a: -l install,uninstallcake:ver:project:app: -- "$@")
while [ $# -gt 0 ]
do
case "$1" in
(-a) app=$2; shift;;
(-c) cakephp_core=$2; shift;;
(-p) project=$2; shift;;
(-v) cakephp_ver=$2; shift;;
(-i) command="install";;
(-u) command="uninstall";;
(--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
(*) break;;
esac
shift
done
case $command in
install)
install_path=$PWD
project_root_path=$install_path/$project
cakephp_core_path=$install_path/$cakephp_core/$cakephp_ver
echo "Install cakephp core, make project skeleton"
#download cakephp core
mkdir $cakephp_core
cd $cakephp_core
git clone $CAKEPHP_REPOSITORY $cakephp_ver
cd $cakephp_ver
git checkout -b $cakephp_ver origin/$cakephp_ver
#make project directory and copy app, webroot, change persmission tmp directory
cd $install_path
mkdir $project
cd $project
mkdir plugins
rsync -a --exclude='webroot' $cakephp_core_path/app/* $app/
chmod 707 -R $app/tmp
cp -r $cakephp_core_path/app/webroot public_html
#generate index.php for this environment
cd $install_path
curl $DEFAULT_INDEX_URL > index.php-1.3
sed -e "s;%ROOT%;$project_root_path;" -e "s;%APP%;$app;" -e "s;%CORE%;$cakephp_core_path;" index.php-1.3 > index.php
mv index.php $project_root_path/public_html/
rm index.php-1.3
;;
uninstall)
echo "Uninstall is not supported"
;;
esac