#!/bin/bash running_user=$( id -un ) if [ "$running_user" != "{{ mailman_user }}" ] ; then logger "mailman-postupdate: must be run by the mailman user" echo "mailman-postupdate must be run by the mailman user" exit 1 fi set -e postorius_dir="{{ mailman_postorius_dir }}" postorius_executable="{{ mailman_postorius_dir }}/manage.py" set -x if [ "$DEBUG" == "False" ]; then mkdir -p "$postorius_dir/static" || : "$postorius_executable" collectstatic --clear --noinput --verbosity 0 "$postorius_executable" compress "$postorius_executable" compilemessages fi syncdb_cmd="$postorius_executable 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 "$postorius_executable" update_index