make scripts cwd blind

This commit is contained in:
Benjamin Dauvergne 2013-07-15 18:19:19 +02:00
parent f3ff3aeaba
commit bd93ce971f
3 changed files with 17 additions and 14 deletions

View File

@ -1,6 +1,7 @@
BASE=`dirname $0`
PROJECT=authentic2 PROJECT=authentic2
CTL=${PROJECT}-ctl CTL=$BASE/${PROJECT}-ctl
VENV=${PROJECT}-venv VENV=$BASE/${PROJECT}-venv
. $VENV/bin/activate . $VENV/bin/activate
# ./$CTL loaddata # ./$CTL loaddata

11
run.sh
View File

@ -1,11 +1,12 @@
#!/bin/sh #!/bin/sh
BASE=`dirname $0`
PROJECT=authentic2 PROJECT=authentic2
CTL=${PROJECT}-ctl CTL=$BASE/${PROJECT}-ctl
VENV=${PROJECT}-venv VENV=$BASE/${PROJECT}-venv
if [ ! -d $VENV ]; then if [ ! -d $VENV ]; then
./start.sh $BASE/start.sh
else else
. ./$VENV/bin/activate . $VENV/bin/activate
./$CTL "${@:-runserver}" $CTL "${@:-runserver}"
fi fi

View File

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
BASE=`dirname $0`
PROJECT=authentic2 PROJECT=authentic2
CTL=${PROJECT}-ctl CTL=$BASE/${PROJECT}-ctl
VENV=${PROJECT}-venv VENV=$BASE/${PROJECT}-venv
if [ "$VIRTUAL_ENV" = "" ]; then if [ "$VIRTUAL_ENV" = "" ]; then
if which mkvirtualenv >/dev/null 2>&1; then if which mkvirtualenv >/dev/null 2>&1; then
@ -10,15 +11,15 @@ if [ "$VIRTUAL_ENV" = "" ]; then
if [ ! -d $VENV ]; then if [ ! -d $VENV ]; then
virtualenv --system-site-packages $VENV 2>/dev/null || virtualenv $VENV virtualenv --system-site-packages $VENV 2>/dev/null || virtualenv $VENV
fi fi
. ./$VENV/bin/activate . $VENV/bin/activate
fi fi
fi fi
easy_install -U pip distribute easy_install -U pip distribute
pip install -U django>1.5.0,<1.6 pip install -U django>1.5.0,<1.6
pip install -U -r requirements.txt pip install -U -r requirements.txt
if [ ! -f $PROJECT.db ]; then if [ ! -f $PROJECT.db ]; then
./$CTL syncdb --all --noinput $CTL syncdb --all --noinput
./$CTL migrate --fake $CTL migrate --fake
./load-base-data.sh $BASE/load-base-data.sh
fi fi
./$CTL runserver $CTL runserver