summaryrefslogtreecommitdiff
path: root/install/install.sh
diff options
context:
space:
mode:
authorCyril Brulebois <cyril@debamax.com>2016-04-03 05:17:19 +0200
committerCyril Brulebois <cyril@debamax.com>2016-04-03 05:55:05 +0200
commitac8c5e9f1d02bbc235f4c1a2664f1ab8d3c3798f (patch)
tree63a89904a60bb6274bd7864cb40c3daa4031ceee /install/install.sh
parentd459f5eb9232bd3da3e779ac32bf5065b9680212 (diff)
downloadIshtar-ac8c5e9f1d02bbc235f4c1a2664f1ab8d3c3798f.tar.bz2
Ishtar-ac8c5e9f1d02bbc235f4c1a2664f1ab8d3c3798f.zip
Make INSTALL_PREFIX configurable.
Since a comment insisted on this topic, make sure to add a trailing slash if that variable wasn't set properly. This means adjusting the templates in addition to the main script. A slash is kept as a separator in those to keep them readable, which explains the slightly awkward (uwsgi and nginx) sed calls.
Diffstat (limited to 'install/install.sh')
-rwxr-xr-xinstall/install.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/install/install.sh b/install/install.sh
index 7358ee747..049a8a34a 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -41,7 +41,10 @@ UWSGI_PORT=${UWSGI_PORT-8891}
NGINX_PORT=${NGINX_PORT-80}
# don't forget the trailing slash
-INSTALL_PREFIX=/srv/
+INSTALL_PREFIX=${INSTALL_PREFIX-/srv/}
+if ! echo "$INSTALL_PREFIX" | grep -qs '/$'; then
+ INSTALL_PREFIX="$INSTALL_PREFIX/"
+fi
# if a virtualenv is used put the full path of the python to use
PYTHON=python
@@ -235,8 +238,11 @@ $PYTHON ./manage.py migrate --fake 2> /dev/null > /dev/null
echo '* uwsgi configuration'
+# NOTE: Replacing #INSTALL_PREFIX#/ is done on purpose, since we
+# ensured that variable has a trailing slash.
sed -s "s|#APP_NAME#|$APP_NAME|g;\
s|#DB_NAME#|$DB_NAME|g;\
+ s|#INSTALL_PREFIX#/|$INSTALL_PREFIX|g;\
s|#URL#|$URL|g;\
s|#UWSGI_PORT#|$UWSGI_PORT|g;" $CDIR'/uwsgi.ini.template' > \
$INSTALL_PATH'/conf/uwsgi.ini'
@@ -254,11 +260,14 @@ service uwsgi restart
echo '* nginx configuration'
+# NOTE: Replacing #INSTALL_PREFIX#/ is done on purpose, since we
+# ensured that variable has a trailing slash.
sed -s "s|#APP_NAME#|$APP_NAME|g;\
s|#UWSGI_PORT#|$UWSGI_PORT|g;\
s|#DB_NAME#|$DB_NAME|g;\
s|#DATE#|$DATE|g;\
s|#NGINX_PORT#|$NGINX_PORT|g;\
+ s|#INSTALL_PREFIX#/|$INSTALL_PREFIX|g;\
s|#URL#|$URL|g;" $CDIR'/nginx.conf.template' > \
$INSTALL_PATH'/conf/nginx.conf'
ln -s $INSTALL_PATH'/conf/nginx.conf' \