From 58094cf876dca04498b9aaa38a42aef0b78c51ae Mon Sep 17 00:00:00 2001
From: RomanSteinberg <romanofficial@yandex.ru>
Date: Fri, 22 Aug 2014 18:19:22 +0400
Subject: [PATCH] FIX: deployment scripts

---
 deploy.sh  | 25 +++++++++++++++++++++----
 install.sh |  2 +-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/deploy.sh b/deploy.sh
index 1392d67b0..2d042cfcc 100644
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,7 +1,24 @@
-cp $1/web/* $2
+#source
+if [ -z $1 ] || ![ -d $1 ]
+then
+  s="~/grade-rating/"
+else
+  s=$1
+fi
+
+#destination
+if [ -z $2 ] || ![ -d $2 ]
+then
+  d="~/public_html/"
+else  
+  d=$2
+fi
+
+#shopt -s dotglob
+cp -rp $s"web/*" $d
 mysqladmin -u mmcs_rating -pPefnesdy drop mmcs_rating
 mysqladmin -u mmcs_rating -pPefnesdy create mmcs_rating
-mysql mmcs_rating < $1/db/Structure.sql
-mysql mmcs_rating < $1/db/StoredProcedures.sql
-mysql mmcs_rating < $1/db/Sample.sql
+mysql -u mmcs_rating -pPefnesdy mmcs_rating < $s"db/Structure.sql"
+mysql -u mmcs_rating -pPefnesdy mmcs_rating < $s"db/StoredProcedures.sql"
+mysql -u mmcs_rating -pPefnesdy mmcs_rating < $s"db/Sample.sql"
 
diff --git a/install.sh b/install.sh
index 92bca721e..a061ed283 100644
--- a/install.sh
+++ b/install.sh
@@ -1,4 +1,4 @@
 rm -rf ~/grade-rating
-git clone http://itlab.mmcs.sfedu.ru/git/grade-rating ~/
+git clone http://itlab.mmcs.sfedu.ru/git/grade-rating ~/grade-rating
 ~/grade-rating/deploy.sh ~/grade-rating ~/public_html
 
-- 
GitLab