From 4b0142dfcfca7c33e9a700c76b884db3a18756a2 Mon Sep 17 00:00:00 2001 From: Jakob Hirsch Date: Tue, 7 Dec 2010 06:00:48 +0800 Subject: [PATCH 1/2] encapsulate cwd changes this way we can also handle relative paths for vz and doctrine --- share/tools/install.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/tools/install.sh b/share/tools/install.sh index 7ff69fc..42626f7 100644 --- a/share/tools/install.sh +++ b/share/tools/install.sh @@ -44,13 +44,14 @@ if [ "$REPLY" == 'y' ]; then echo "installing doctrine into $dtdir" mkdir -p $dtdir git clone git://github.com/doctrine/doctrine2.git $dtdir - cd $dtdir + pushd $dtdir git submodule init git submodule update cd lib/Doctrine ln -s ../vendor/doctrine-dbal/lib/Doctrine/DBAL/ . ln -s ../vendor/doctrine-common/lib/Doctrine/Common/ . + popd fi ############ @@ -68,12 +69,12 @@ if [ "$REPLY" == 'y' ]; then mkdir -p $vzdir git clone git://github.com/volkszaehler/volkszaehler.org.git $vzdir - cd $vzdir/backend/lib/vendor + pushd $vzdir/backend/lib/vendor ln -s $dtdir/lib/Doctrine/ . ln -s $dtdir/lib/vendor/Symfony/ . + popd fi -cd $vzdir config=$vzdir/backend/volkszaehler.conf.php ############ @@ -103,9 +104,10 @@ if [ "$REPLY" == "y" ]; then echo creating tables... mysql -h$db_host -u$db_admin_user -p$db_admin_pass -e 'CREATE DATABASE `volkszaehler`' - cd $vzdir + pushd $vzdir php backend/bin/doctrine orm:schema-tool:create - + popd + echo "creating db user $db_user with proper rights..." mysql -h$db_host -u$db_admin_user -p$db_admin_pass <<-EOF CREATE USER '$db_user'@'$db_host' IDENTIFIED BY '$db_pass'; From 9419d91930cdb3dc903d6bd3b86503e1aa093c83 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 10 Dec 2010 19:05:22 +0800 Subject: [PATCH 2/2] install script fixes - removed bad tab from vz dir test - use the actually entered database name, not hard coded volkszaehler - git URLs are now configured at top of the script --- share/tools/install.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) mode change 100644 => 100755 share/tools/install.sh diff --git a/share/tools/install.sh b/share/tools/install.sh old mode 100644 new mode 100755 index 42626f7..d6131c4 --- a/share/tools/install.sh +++ b/share/tools/install.sh @@ -8,6 +8,9 @@ db_host=localhost set -e shopt -s nocasematch +doctrine_git=git://github.com/doctrine/doctrine2.git +vz_git=git://github.com/volkszaehler/volkszaehler.org.git + ask() { question=$1 default=$2 @@ -43,7 +46,7 @@ test -e "$dtdir" && ask "$dtdir already exists. overwrite?" n if [ "$REPLY" == 'y' ]; then echo "installing doctrine into $dtdir" mkdir -p $dtdir - git clone git://github.com/doctrine/doctrine2.git $dtdir + git clone $doctrine_git $dtdir pushd $dtdir git submodule init git submodule update @@ -63,11 +66,11 @@ ask "volkszaehler path?" /var/www/vz vzdir=$REPLY REPLY=y -test -e "$vzdir " && ask "$vzdir already exists. overwrite?" n +test -e "$vzdir" && ask "$vzdir already exists. overwrite?" n if [ "$REPLY" == 'y' ]; then echo "installing volkszaehler.org into $vzdir" mkdir -p $vzdir - git clone git://github.com/volkszaehler/volkszaehler.org.git $vzdir + git clone $vz_git $vzdir pushd $vzdir/backend/lib/vendor ln -s $dtdir/lib/Doctrine/ . @@ -102,8 +105,8 @@ ask "create database?" y if [ "$REPLY" == "y" ]; then get_admin - echo creating tables... - mysql -h$db_host -u$db_admin_user -p$db_admin_pass -e 'CREATE DATABASE `volkszaehler`' + echo creating database $db_name... + mysql -h$db_host -u$db_admin_user -p$db_admin_pass -e 'CREATE DATABASE `'$db_name'`' pushd $vzdir php backend/bin/doctrine orm:schema-tool:create popd