summaryrefslogtreecommitdiff
path: root/install/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'install/install.sh')
-rwxr-xr-xinstall/install.sh50
1 files changed, 26 insertions, 24 deletions
diff --git a/install/install.sh b/install/install.sh
index 9a2ba4094..798278638 100755
--- a/install/install.sh
+++ b/install/install.sh
@@ -5,13 +5,13 @@
######################################################################
# only lower alpha-numeric char and '_' and must start with a letter
-[ $APP_NAME ] || ( echo 'APP_NAME empty. Default to: "default".' ; );
+[ -z "$APP_NAME" ] && ( echo 'APP_NAME empty. Default to: "default".' ; );
APP_NAME=${APP_NAME-default}
-[ $URL ] || ( echo 'URL empty. Default to: "localhost".' ; URL=localhost ; );
+[ -z $URL ] && ( echo 'URL empty. Default to: "localhost".' ; URL=localhost ; );
URL=${URL-localhost}
-[ $PROJECT_NAME ] || ( echo 'PROJECT_NAME empty. Default to: "Test".' ; );
+[ -z "$PROJECT_NAME" ] && ( echo 'PROJECT_NAME empty. Default to: "Test".' ; );
PROJECT_NAME=${PROJECT_NAME-Test}
DEFAULT_DATA='fr' # available data: 'fr'
@@ -22,17 +22,17 @@ DEFAULT_DATA='fr' # available data: 'fr'
# if the database is not local the database will be not automatically
# created
-[ $DB_HOST ] || ( echo 'DB_HOST empty. Default to: "127.0.0.1".' ; );
+[ -z $DB_HOST ] && ( echo 'DB_HOST empty. Default to: "127.0.0.1".' ; );
DB_HOST=${DB_HOST-127.0.0.1}
# if not set automatically generated
-DB_PASSWORD=''
+DB_PASSWORD=${DB_PASSWORD-''}
DB_PORT='5432'
PG_VERSION=9.1
# ishtar git branch
-[ $VERSION ] || ( echo 'VERSION empty. Default to: "stable".' ; );
-VERSION=stable
+[ -z "$VERSION" ] && ( echo 'VERSION empty. Default to: "stable".' ; );
+VERSION=${VERSION-stable}
# change it for each instance on a same server
UWSGI_PORT=${UWSGI_PORT-8891}
@@ -56,6 +56,7 @@ NGINX_ENABLE_PATH='/etc/nginx/sites-enabled/'
######################################################################
echo "* installing dependencies"
+
if [ $DB_HOST = "127.0.0.1" ]; then
apt-get -q -y install postgresql postgresql-$PG_VERSION-postgis postgresql 2> /dev/null > /dev/null
fi
@@ -66,6 +67,7 @@ apt-get -q -y install python python-django \
libjs-jquery libjs-jquery-ui python-pisa python-django-registration \
python-utidylib python-lxml python-imaging python-django-south \
python-psycopg2 python-gdal gettext python-bs4 python-tidylib \
+ python-unicodecsv \
python-django-extra-views python-memcache python-dbf 2> /dev/null > /dev/null
apt-get -q -y install uwsgi uwsgi-plugin-python nginx memcached 2> /dev/null > /dev/null
@@ -102,7 +104,7 @@ fi
if [ `psql -l | grep $DB_NAME | wc -l` -ne 1 ]; then
echo " * create "$DB_NAME
createuser --echo --adduser --createdb --encrypted $DB_NAME 2> /dev/null > /dev/null
- psql --command "ALTER USER "$DB_NAME" with password '"$DB_PASSWORD"';" 2> /dev/null > /dev/null
+ psql --command "ALTER USER \""$DB_NAME"\" with password '"$DB_PASSWORD"';" 2> /dev/null > /dev/null
createdb -T template_postgis --echo --owner $DB_NAME --encoding UNICODE $DB_NAME "$PROJECT_NAME" 2> /dev/null > /dev/null
fi
@@ -118,7 +120,7 @@ mkdir $INSTALL_PATH'/conf'
cd $INSTALL_PATH
echo ' * ishtar'
-git clone git://git.proxience.com/git/ishtar.git 2> /dev/null
+git clone https://gitlab.com/ishtar/ishtar.git 2> /dev/null
echo ' * oook!'
git clone git://git.proxience.com/git/oook_replace.git 2> /dev/null
ln -s $INSTALL_PATH'/oook_replace/oook_replace' $INSTALL_PATH'/ishtar/'
@@ -218,20 +220,20 @@ python ./manage.py createsuperuser
$PYTHON ./manage.py migrate --fake 2> /dev/null > /dev/null
# add a default site
-echo '[{"pk":null, "model": "sites.site", "fields": {"domain": "'$URL'", "name": "'$PROJECT_NAME'"}}]' > \
- /tmp/site.json
-python ./manage.py loaddata /tmp/site.json
-rm /tmp/site.json
+#echo '[{"pk":null, "model": "sites.site", "fields": {"domain": "'$URL'", "name": "'$PROJECT_NAME'"}}]' > \
+# /tmp/site.json
+#python ./manage.py loaddata /tmp/site.json
+#rm /tmp/site.json
echo '* uwsgi configuration'
-sed -s "s/#APP_NAME#/$APP_NAME/g;\
- s/#DB_NAME#/$DB_NAME/g;\
- s/#URL#/$URL/g;\
- s/#UWSGI_PORT#/$UWSGI_PORT/g;" $CDIR'/uwsgi.ini.template' > \
+sed -s "s|#APP_NAME#|$APP_NAME|g;\
+ s|#DB_NAME#|$DB_NAME|g;\
+ s|#URL#|$URL|g;\
+ s|#UWSGI_PORT#|$UWSGI_PORT|g;" $CDIR'/uwsgi.ini.template' > \
$INSTALL_PATH'/conf/uwsgi.ini'
-sed -s "s/#APP_NAME#/$APP_NAME/g;" $CDIR'/django.wsgi.template' > \
+sed -s "s#APP_NAME#/$APP_NAME/g;" $CDIR'/django.wsgi.template' > \
$INSTALL_PATH'/conf/'$APP_NAME'.wsgi'
ln -s $INSTALL_PATH'/conf/uwsgi.ini' \
@@ -244,12 +246,12 @@ service uwsgi restart
echo '* nginx configuration'
-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/#URL#/$URL/g;" $CDIR'/nginx.conf.template' > \
+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|#URL#|$URL|g;" $CDIR'/nginx.conf.template' > \
$INSTALL_PATH'/conf/nginx.conf'
ln -s $INSTALL_PATH'/conf/nginx.conf' \
$NGINX_AVAILABLE_PATH$APP_NAME'.conf'