diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-01-31 15:47:20 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-11-04 18:49:51 +0100 | 
| commit | 2b8b1ba48703ec9adb427900f979dca364be8da6 (patch) | |
| tree | 4bc591788f8dd4603d66d39122341ccf5ab7cd82 /debian/python3-django-ishtar.postinst | |
| parent | be103c4a4dd9d8f82d89e4116e417ee09e542fc0 (diff) | |
| download | Ishtar-2b8b1ba48703ec9adb427900f979dca364be8da6.tar.bz2 Ishtar-2b8b1ba48703ec9adb427900f979dca364be8da6.zip | |
Adapt postinst script to python3 - Addexemple_project to links
Diffstat (limited to 'debian/python3-django-ishtar.postinst')
| -rw-r--r-- | debian/python3-django-ishtar.postinst | 54 | 
1 files changed, 22 insertions, 32 deletions
| diff --git a/debian/python3-django-ishtar.postinst b/debian/python3-django-ishtar.postinst index 4d850ac27..efef50835 100644 --- a/debian/python3-django-ishtar.postinst +++ b/debian/python3-django-ishtar.postinst @@ -4,50 +4,40 @@ set -e  set -x  DATA_DIR=/srv/ishtar -INSTANCES_FILE=/etc/ishtar/instances +CONFIG_PATH=/etc/ishtar +INSTANCES_FILE=$CONFIG_PATH/instances  case "$1" in      configure) -        mkdir -p /etc/ishtar/ -        if [ ! -f /etc/ishtar/config ]; then -            cp /usr/share/python3-django-ishtar/install/config.template /etc/ishtar/config ; +        mkdir -p $CONFIG_PATH +        if [ ! -f $CONFIG_PATH/config ]; then +            cp /usr/share/python3-django-ishtar/install/config.template $CONFIG_PATH/config ; +        fi +        . $CONFIG_PATH/config +        export LANG=$ISHTAR_LOCALE.UTF-8 +        if [ "$(locale 2>&1 >/dev/null|wc -l)" != 0 ]; then +            echo r "Unable to set LANG=$LANG properly" +            echo "Try: 'dpkg-reconfigure locales' or install the 'locales-all' package." +            echo "If you want to use another locale, modify /etc/ishtar/config properly." +            exit 1          fi          instances="$( (cat $INSTANCES_FILE 2>/dev/null || true) | xargs )"          if [ -n "$instances" ]; then              echo "updading instances found in $INSTANCES_FILE: $instances" +            messages_compiled="";              for instance in $instances; do +                if [ ! $messages_compiled ]; then +                  (cd $DATA_DIR; python3 $DATA_DIR/$instance/manage.py compilemessages); +                  messages_compiled="ok"; +                fi                  # The upgrade procedure below was built from the "update"                  # target and its dependencies in the upstream Makefile:                  echo "updating $instance"                  cd $DATA_DIR/$instance - -                # from "syncdb" target: -                python manage.py syncdb --noinput -                python manage.py migrate - -                # from "compilemessages" target: -                # -                # NOTE: Instead of hardcoding an "apps" variable here, let's -                # look at candidates with find, and check whether each of -                # them indeed contains PO files as a second check: -                maybe_localized=$(cd $DATA_DIR; find -maxdepth 2 -name 'locale') -                for candidate in $maybe_localized; do -                    if find $DATA_DIR/$candidate -name '*.po' >/dev/null 2>&1; then -                        # Really looks like a valid app, let's strip the last -                        # directory, cd into it, and compile messages using -                        # the instance's manage.py script: -                        app=${candidate%%/locale} -                        (cd $DATA_DIR/$app; python $DATA_DIR/$instance/manage.py compilemessages) -                    fi -                done -                # XXX: Doing this only once is likely sufficient, so -                # we could remember having performed that update while -                # taking care of the first instance, to avoid -                # extraneous reruns? - -                # from "collectstatic" target: -                python manage.py collectstatic --noinput - +                # migrate +                python3 manage.py migrate +                # "collectstatic" +                python3 manage.py collectstatic --noinput                  echo "updating $instance: OK"              done              echo "updating all instances: OK" | 
