#!/bin/bash set -e BINDIR="/opt/mailman/mm/bin" CONFDIR="/opt/mailman/mm" SETTINGS="settings" DJANGO_CONTROL_SCRIPT="$BINDIR/django-admin" STATIC_DIR="$CONFDIR/static" DEBUG="False" set -x if [ "$DEBUG" == "False" ]; then mkdir -p "$STATIC_DIR" || : "$DJANGO_CONTROL_SCRIPT" collectstatic --clear --noinput --verbosity 0 "$DJANGO_CONTROL_SCRIPT" compress "$DJANGO_CONTROL_SCRIPT" compilemessages fi syncdb_cmd="$DJANGO_CONTROL_SCRIPT migrate" if [[ ! -t 1 ]]; then # stdout is not a terminal syncdb_cmd="$syncdb_cmd --noinput" fi $syncdb_cmd echo 'Do you want to rebuild the search index? This takes a long time.' echo 'Type "Yes" to continue; anything else to quit.' read -p "> " response if [ "x$response" != "xYes" ] ; then exit; fi "$DJANGO_CONTROL_SCRIPT" update_index