diff options
| author | Cyril Brulebois <cyril@debamax.com> | 2016-04-03 05:17:19 +0200 | 
|---|---|---|
| committer | Cyril Brulebois <cyril@debamax.com> | 2016-04-03 05:55:05 +0200 | 
| commit | ac8c5e9f1d02bbc235f4c1a2664f1ab8d3c3798f (patch) | |
| tree | 63a89904a60bb6274bd7864cb40c3daa4031ceee /install | |
| parent | d459f5eb9232bd3da3e779ac32bf5065b9680212 (diff) | |
| download | Ishtar-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')
| -rwxr-xr-x | install/install.sh | 11 | ||||
| -rw-r--r-- | install/nginx.conf.template | 6 | ||||
| -rw-r--r-- | install/uwsgi.ini.template | 2 | 
3 files changed, 14 insertions, 5 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' \ diff --git a/install/nginx.conf.template b/install/nginx.conf.template index c41018786..8df09e859 100644 --- a/install/nginx.conf.template +++ b/install/nginx.conf.template @@ -1,18 +1,18 @@  server {      listen #NGINX_PORT#;      server_name #URL#; -    root /srv/#DB_NAME#/ishtar/; +    root #INSTALL_PREFIX#/#DB_NAME#/ishtar/;      access_log /var/log/django/#APP_NAME#-access.log;      error_log /var/log/django/#APP_NAME#-error.log;      client_max_body_size 20M;      location /static-#DATE#/ { # STATIC_URL -        alias /srv/#DB_NAME#/ishtar/#APP_NAME#/static/; # STATIC_ROOT +        alias #INSTALL_PREFIX#/#DB_NAME#/ishtar/#APP_NAME#/static/; # STATIC_ROOT          expires 30d;      }      location /media/ { # MEDIA_URL -        alias /srv/#DB_NAME#/ishtar/#APP_NAME#/media/; # MEDIA_ROOT +        alias #INSTALL_PREFIX#/#DB_NAME#/ishtar/#APP_NAME#/media/; # MEDIA_ROOT          expires 30d;      } diff --git a/install/uwsgi.ini.template b/install/uwsgi.ini.template index 7a20c058c..dd8f00480 100644 --- a/install/uwsgi.ini.template +++ b/install/uwsgi.ini.template @@ -2,7 +2,7 @@  # variables  projectname = #APP_NAME#  projectdomain = #URL# -base = /srv/#DB_NAME#/ishtar/ +base = #INSTALL_PREFIX#/#DB_NAME#/ishtar/  # config  plugins = python  | 
