aboutsummaryrefslogtreecommitdiff
path: root/deploy.sh
diff options
context:
space:
mode:
authorMaZderMind2016-12-20 22:38:46 +0100
committerMaZderMind2016-12-20 22:38:46 +0100
commitfa8efe21fd2142935e8e63bf83fc4839c8ec5065 (patch)
tree751649658a5f703e1817d5dfecabaafd950074d3 /deploy.sh
parentc8aaa8d04d785c9d9e84c343b4ebb3aaf524d868 (diff)
parent5ec71310d5ed6e1c4879506de7cae65ef1aab922 (diff)
Merge branch 'master' into events/33c3
Diffstat (limited to '')
-rwxr-xr-xdeploy.sh40
1 files changed, 31 insertions, 9 deletions
diff --git a/deploy.sh b/deploy.sh
index 5f409a8..eec51c5 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,8 +1,9 @@
#!/bin/bash
-command -v find >/dev/null 2>&1 || { echo >&2 "I require find but it's not installed. Aborting."; exit 1; }
-command -v xargs >/dev/null 2>&1 || { echo >&2 "I require xargs but it's not installed. Aborting."; exit 1; }
-command -v php >/dev/null 2>&1 || { echo >&2 "I require php but it's not installed. Aborting."; exit 1; }
+for cmd in find xargs php git; do
+ command -v $cmd >/dev/null 2>&1 || { echo >&2 "I require $cmd but it's not installed. Aborting."; exit 1; }
+done
+
find . -name "*.php" -print0 | xargs -0 -n1 php -l
if [ $? -ne 0 ]; then
@@ -10,20 +11,41 @@ if [ $? -ne 0 ]; then
exit 1
fi
-if [ `git rev-parse --verify origin/master` != `git rev-parse --verify master` ]; then
- echo "You have commits on the master branch not pushed to origin yet. They would not be deployed. aborting"
- exit 2
+echo ""
+DEPLOY_BRANCH=`git rev-parse --abbrev-ref HEAD`
+if [ "x$DEPLOY_BRANCH" != "xmaster" ]; then
+ echo "You're currently on branch $DEPLOY_BRANCH."
+ echo "Are you sure you want to deoloy that branch (and not master)? then type yes"
+ read -p "" input
+ if [ "x$input" != "xyes" ]; then
+ exit 2
+ fi
+fi
+
+if [ `git rev-parse --verify origin/$DEPLOY_BRANCH` != `git rev-parse --verify $DEPLOY_BRANCH` ]; then
+ echo "You have commits on the master branch not pushed to origin yet. They would not be deployed."
+ echo "do you still which to deploy what's already in the repo? then type yes"
+ read -p "" input
+ if [ "x$input" != "xyes" ]; then
+ exit 2
+ fi
fi
if ! (git diff --exit-code >/dev/null || git diff --cached --exit-code >/dev/null); then
- echo "You have uncomitted changes. They would not be deployed. aborting"
- exit 2
+ echo "You have uncomitted changes. They would not be deployed."
+ echo "do you still which to deploy what's already in the repo? then type yes"
+ read -p "" input
+ if [ "x$input" != "xyes" ]; then
+ exit 2
+ fi
fi
ssh -A voc@lb.dus.c3voc.de 'sudo sh' << EOT
cd /srv/nginx/streaming-website
git fetch origin
-git reset --hard origin/master
+git reset --hard HEAD
+git checkout $DEPLOY_BRANCH
+git reset --hard origin/$DEPLOY_BRANCH
chown -R voc:staff .
chown -R downloader configs
./clear_cache