server-share/bin/update

36 строки
788 B
Bash
Executable File

#!/bin/sh
source ~/linkdrop-env/bin/activate
#if run from a hook, GIT_DIR is set
unset GIT_DIR
#find ourselves
SELF=`readlink -f $0`
WORKDIR=`dirname $SELF`
LINKDROP_HOME=`cd $WORKDIR/.. && pwd`
export PATH=$PATH:$LINKDROP_HOME/bin
cd $LINKDROP_HOME
PRE=`git show --pretty=format:"%H|%ci" --quiet`
(
git pull
) 2>&1 > git.log
POST=`git show --pretty=format:"%H|%ci" --quiet`
if [ "$PRE" != "$POST" ]; then
echo "Update from $PRE to $POST"
HOST=`hostname -s`
echo "$POST $HOST" > web/version.txt
make -B web
cat git.log
git diff | perl -pi -e's[(oauth.(google|facebook|twitter).com.(consumer_secret|app_secret)\s+=\s+)(.*)][$1XXXXXXXXXXXX]g' | perl -pi -e's[(sqlalchemy.url = mysql://linkdrop:)(.*)(@.*)][$1XXXXXXXX$3]g'
python setup.py develop
linkdrop-sync
fi