summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
commit2b8b1ba48703ec9adb427900f979dca364be8da6 (patch)
tree4bc591788f8dd4603d66d39122341ccf5ab7cd82
parentbe103c4a4dd9d8f82d89e4116e417ee09e542fc0 (diff)
downloadIshtar-2b8b1ba48703ec9adb427900f979dca364be8da6.tar.bz2
Ishtar-2b8b1ba48703ec9adb427900f979dca364be8da6.zip
Adapt postinst script to python3 - Addexemple_project to links
-rw-r--r--debian/python3-django-ishtar.links1
-rw-r--r--debian/python3-django-ishtar.postinst54
-rwxr-xr-xdebian/rules3
3 files changed, 26 insertions, 32 deletions
diff --git a/debian/python3-django-ishtar.links b/debian/python3-django-ishtar.links
index 210855bed..b1d497126 100644
--- a/debian/python3-django-ishtar.links
+++ b/debian/python3-django-ishtar.links
@@ -2,3 +2,4 @@ usr/share/python3-django-ishtar/install/ishtar-prepare-instance usr/sbin/ishtar-
usr/share/python3-django-ishtar/install/ishtar-delete-instance usr/sbin/ishtar-delete-instance
usr/share/python3-django-ishtar/fixtures srv/ishtar/fixtures
usr/share/python3-django-ishtar/locale srv/ishtar/locale
+usr/share/python3-django-ishtar/example_project srv/ishtar/example_project
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"
diff --git a/debian/rules b/debian/rules
index 55b23e74c..a625f2c6a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,4 +26,7 @@ override_dh_auto_test:
sudo -u postgres psql -c "ALTER USER \"ishtar-setup-test\" WITH PASSWORD 'ishtar-setup-test';"
sudo -u postgres createdb -O ishtar-setup-test ishtar-setup-test
dh_auto_test
+ sudo -u postgres psql -c 'DROP DATABASE IF EXISTS "ishtar-setup-test";'
+ sudo -u postgres psql -c 'DROP DATABASE IF EXISTS "test_ishtar-setup-test";'
+ sudo -u postgres psql -c 'DROP ROLE IF EXISTS "ishtar-setup-test";'