Generate postgresql.conf with LC_ALL=en_US.UTF-8 pg_createcluster.
[invirt/packages/invirt-database.git] / debian / rules
index d2e9b8f..38b97df 100755 (executable)
@@ -4,15 +4,29 @@ DEB_PYTHON_SYSTEM=pysupport
 
 DEB_DIVERT_EXTENSION = .invirt
 
-DEB_TRANSFORM_FILES_invirt-database-server += \
-       /etc/postgresql/8.3/main/postgresql.conf.invirt
-
 DEB_DIVERT_FILES_invirt-database-server += \
+       /etc/postgresql/8.3/main/postgresql.conf.invirt \
        /etc/init.d/postgresql-8.3.invirt
 
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/python-distutils.mk
 include /usr/share/cdbs/1/rules/config-package.mk
 
+common-build-indep:: debian/postgresql.conf.invirt
+
+debian/postgresql.conf.invirt: debian/transform_postgresql.conf.invirt
+       set -e; \
+       export invirt_tmp="$$(mktemp -dt invirt-database.XXXXXX)"; \
+       PG_CLUSTER_CONF_ROOT="$$invirt_tmp/etc/postgresql" \
+           LC_ALL=en_US.UTF-8 \
+           pg_createcluster 8.3 main \
+           --datadir="$$invirt_tmp/var/lib/postgresql/8.3/main" \
+           --socketdir=/var/run/postgresql \
+           --port=5432; \
+       chmod +x $<; \
+       $< < "$$invirt_tmp/etc/postgresql/8.3/main/postgresql.conf" > $@; \
+       rm -rf "$$invirt_tmp"
+
 clean::
        rm -rf invirt.database.egg-info
+       rm -f debian/postgresql.conf.invirt