summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGérald Fenoy <djay@gentoo.org>2007-10-17 13:30:37 +0000
committerGérald Fenoy <djay@gentoo.org>2007-10-17 13:30:37 +0000
commit86271612330d3fba4cfdab3248b578d8db3cab94 (patch)
treedce8941badefeb3de200b895aca62c1a8f553bd4 /dev-db/postgis
parentbump. (diff)
downloadhistorical-86271612330d3fba4cfdab3248b578d8db3cab94.tar.gz
historical-86271612330d3fba4cfdab3248b578d8db3cab94.tar.bz2
historical-86271612330d3fba4cfdab3248b578d8db3cab94.zip
Version bump for 1.2.1 and 1.3.1 versions of PostGIS
Package-Manager: portage-2.1.3.9
Diffstat (limited to 'dev-db/postgis')
-rw-r--r--dev-db/postgis/ChangeLog9
-rw-r--r--dev-db/postgis/Manifest34
-rw-r--r--dev-db/postgis/files/digest-postgis-1.2.13
-rw-r--r--dev-db/postgis/files/digest-postgis-1.3.13
-rw-r--r--dev-db/postgis/postgis-1.2.1.ebuild196
-rw-r--r--dev-db/postgis/postgis-1.3.1.ebuild181
6 files changed, 421 insertions, 5 deletions
diff --git a/dev-db/postgis/ChangeLog b/dev-db/postgis/ChangeLog
index ae0d030af209..54d049deb567 100644
--- a/dev-db/postgis/ChangeLog
+++ b/dev-db/postgis/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-db/postgis
# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.29 2007/09/19 15:57:45 calchan Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/ChangeLog,v 1.30 2007/10/17 13:30:36 djay Exp $
+
+*postgis-1.3.1 (19 Dec 2007)
+*postgis-1.2.1 (19 Dec 2007)
+
+ 19 Dec 2007; <djay@gentoo.org> +postgis-1.2.1.ebuild,
+ +postgis-1.3.1.ebuild:
+ Version bump for 1.2.1 and 1.3.1 version of the PostGIS ebuild
19 Sep 2007; Denis Dupeyron <calchan@gentoo.org> postgis-1.2.0.ebuild:
Fixed typo, see bug #193013.
diff --git a/dev-db/postgis/Manifest b/dev-db/postgis/Manifest
index a4449fad9e53..d4f77c201302 100644
--- a/dev-db/postgis/Manifest
+++ b/dev-db/postgis/Manifest
@@ -1,3 +1,6 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
AUX postgis-1.1.1_doc.patch 711 RMD160 182a5127d83b18b48c5b013b63427d485f770e36 SHA1 00ad7282712c851fc38c852a8d21a70c5ab2b969 SHA256 4c0b50b26bc22e09d60ac14ad4639880e1fca7c92eb55929d6dc10c0ec4ce691
MD5 12ed945462c95968c560ca03fe6de27f files/postgis-1.1.1_doc.patch 711
RMD160 182a5127d83b18b48c5b013b63427d485f770e36 files/postgis-1.1.1_doc.patch 711
@@ -8,6 +11,8 @@ RMD160 052a9578b27edbded5f7885de5efa3595b4c7ac1 files/postgis_xsl.patch 1058
SHA256 ed309baa8aa7e9f10f1006c954f75aa9a4898c820ae46b76d5389c618fb7c08d files/postgis_xsl.patch 1058
DIST postgis-1.1.4.tar.gz 1853989 RMD160 8441aba816154ebe743a93334df9df43a15fa87e SHA1 96afd988aeabb92efa0a99b25cc77be29c700dde SHA256 8f7c74c34431120364d623d0d7ef2556ae6c9bb153b9621eb93ebf56a5396018
DIST postgis-1.2.0.tar.gz 2077747 RMD160 4f2ce71ffd49649cd5712a8bc1a6b822d968797a SHA1 b6e33324c4c2dddc925e7bac86fb1f9c635f20a6 SHA256 7d8f5782ddca38199a1630765e4a2b6d7d703af0cc28d04685cbc6156177d9cb
+DIST postgis-1.2.1.tar.gz 2084672 RMD160 b5f8c542a143d460ebc1387a0d9e4b69335e73c3 SHA1 0a47bde414bf691fb624ead37cc119687aba14df SHA256 edb57786b78bf89b72f60607cb38fa10da00354c2c4476c09bb3d88ca3c0d61f
+DIST postgis-1.3.1.tar.gz 2148125 RMD160 f199505dc04bd2caa0400c9235bbf1aecfe14b6f SHA1 db8e954dfc19e73c2331358a396e2064d1333a72 SHA256 5ce999ae638c1c9f75a7cf85d416eac71cc2d6f668132c2b6a3ae6a12075555c
EBUILD postgis-1.1.4.ebuild 2673 RMD160 b6ce2679497231931e4f3ca1d5d60e5db63805ae SHA1 a5203055b41fabb4610a6137a98dd50e6dc134ff SHA256 19e71582fa0a997e44ff594b8bcef5818884ad3e48c512673e486ccce3f76523
MD5 228658ca0a66b4490f83fedcdc5beee8 postgis-1.1.4.ebuild 2673
RMD160 b6ce2679497231931e4f3ca1d5d60e5db63805ae postgis-1.1.4.ebuild 2673
@@ -16,10 +21,18 @@ EBUILD postgis-1.2.0.ebuild 5373 RMD160 c2ae62e5a07fbecb5cc23594190d5a098cb250eb
MD5 b0b1dc244cbf9acb40c3a1cbf3940fd8 postgis-1.2.0.ebuild 5373
RMD160 c2ae62e5a07fbecb5cc23594190d5a098cb250eb postgis-1.2.0.ebuild 5373
SHA256 5d46ac3acaf76dda719154ea4330a1aa49116b23a7e0257599156ccaa15e4e13 postgis-1.2.0.ebuild 5373
-MISC ChangeLog 3565 RMD160 05ae5998a6a36068dd8315dcd69bcbabe605d54f SHA1 d353fb626e195b1af539dd68f5ace6e26618e248 SHA256 b2b5847f35d6d6a08d3414042ffb346b7f2cd36a48a5a7b42239da7f00675202
-MD5 c7cbcec597ec36eafb07764d116d4f41 ChangeLog 3565
-RMD160 05ae5998a6a36068dd8315dcd69bcbabe605d54f ChangeLog 3565
-SHA256 b2b5847f35d6d6a08d3414042ffb346b7f2cd36a48a5a7b42239da7f00675202 ChangeLog 3565
+EBUILD postgis-1.2.1.ebuild 5566 RMD160 be9fa8d8e33b711031e50b610eb1b5805da4912a SHA1 04f8fc0f56bf77861f412dbd2840282c0d0e63b2 SHA256 2ead570f87d9c1029e3175099d6b3a984a13d0c17bf56566d6a405d8e55f49ae
+MD5 e24150f6b201c33dcacf131d15777d37 postgis-1.2.1.ebuild 5566
+RMD160 be9fa8d8e33b711031e50b610eb1b5805da4912a postgis-1.2.1.ebuild 5566
+SHA256 2ead570f87d9c1029e3175099d6b3a984a13d0c17bf56566d6a405d8e55f49ae postgis-1.2.1.ebuild 5566
+EBUILD postgis-1.3.1.ebuild 5287 RMD160 1eb58fe8c3bd95658d32c8bac8dba77705cdcc29 SHA1 d2ad82950ac61a9624794ad5f3da918246d04673 SHA256 a0f9d446f11a3e9b980ca946385e77d0d1795e7bb41d4cb0acbb53cf6b48e858
+MD5 8839057d23b339bdae8ede3dabec1a8b postgis-1.3.1.ebuild 5287
+RMD160 1eb58fe8c3bd95658d32c8bac8dba77705cdcc29 postgis-1.3.1.ebuild 5287
+SHA256 a0f9d446f11a3e9b980ca946385e77d0d1795e7bb41d4cb0acbb53cf6b48e858 postgis-1.3.1.ebuild 5287
+MISC ChangeLog 3768 RMD160 c6b9e564a296047812da8d31ecf2065bafa627e3 SHA1 37e127d1b9606c700a2e9cffaf38e8d5d3b2d42b SHA256 cba23bd96922d04cdb76838a1e79526c18cd37e1140a8de8f10da4904d3d6e8c
+MD5 e6c4dac200c7f35244c9e836cd74a257 ChangeLog 3768
+RMD160 c6b9e564a296047812da8d31ecf2065bafa627e3 ChangeLog 3768
+SHA256 cba23bd96922d04cdb76838a1e79526c18cd37e1140a8de8f10da4904d3d6e8c ChangeLog 3768
MISC metadata.xml 194 RMD160 19177cc0060792a4212a48493143cc82f0302ef8 SHA1 4acac2c575abc8f6bfe00506117dc2f83a8355a2 SHA256 58a43dec1240568210b57a8396a5d317593309353f64e474c93d12a39a7bc071
MD5 b37bf0bf48388c9f32b981c5bb00468e metadata.xml 194
RMD160 19177cc0060792a4212a48493143cc82f0302ef8 metadata.xml 194
@@ -30,3 +43,16 @@ SHA256 ab448b547354b8a5cf4e1eb12d643d1dd8c0427c932f35a8f5ad5c5e64f97b10 files/di
MD5 eb0637aa1fc2a780e1ec9ed54d0d6a2f files/digest-postgis-1.2.0 244
RMD160 390369df28592de2364eed68ada3d0f67b2fcc82 files/digest-postgis-1.2.0 244
SHA256 c9bcac468877fd1a90215723d8c00fd69caee2286b631b04ff6e798ee20c639c files/digest-postgis-1.2.0 244
+MD5 39ef903a943bb9825e110322a42bce52 files/digest-postgis-1.2.1 244
+RMD160 a53de1e2fc1fd284817df2120e777a0209fd579a files/digest-postgis-1.2.1 244
+SHA256 530227be2493367249e4ec5a0387543af3694b1ed5490b50b4af70db1e797a0e files/digest-postgis-1.2.1 244
+MD5 56e70a82ea5adbbda68fbf433d5e950d files/digest-postgis-1.3.1 244
+RMD160 e57735604db5a5ee05a6189e1dffa09c7632f79a files/digest-postgis-1.3.1 244
+SHA256 feabb9c0ea3ee68ce348524086ca792117ab0d1655db9be2a155451a3cdf85cd files/digest-postgis-1.3.1 244
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFHaIA6DL3RqOXecAkRAt0wAKCX3psGbNY3ovduXvHyUFXSC4j+owCfUMp2
+BoXpuJ2ddpYZxY49CIMO42U=
+=HGwX
+-----END PGP SIGNATURE-----
diff --git a/dev-db/postgis/files/digest-postgis-1.2.1 b/dev-db/postgis/files/digest-postgis-1.2.1
new file mode 100644
index 000000000000..c4f12f19024c
--- /dev/null
+++ b/dev-db/postgis/files/digest-postgis-1.2.1
@@ -0,0 +1,3 @@
+MD5 95430ee371c64a992ebcd8ddf2801acf postgis-1.2.1.tar.gz 2084672
+RMD160 b5f8c542a143d460ebc1387a0d9e4b69335e73c3 postgis-1.2.1.tar.gz 2084672
+SHA256 edb57786b78bf89b72f60607cb38fa10da00354c2c4476c09bb3d88ca3c0d61f postgis-1.2.1.tar.gz 2084672
diff --git a/dev-db/postgis/files/digest-postgis-1.3.1 b/dev-db/postgis/files/digest-postgis-1.3.1
new file mode 100644
index 000000000000..37d8c8093cf3
--- /dev/null
+++ b/dev-db/postgis/files/digest-postgis-1.3.1
@@ -0,0 +1,3 @@
+MD5 dd90f80072fc3e32d3a3eb580542bda1 postgis-1.3.1.tar.gz 2148125
+RMD160 f199505dc04bd2caa0400c9235bbf1aecfe14b6f postgis-1.3.1.tar.gz 2148125
+SHA256 5ce999ae638c1c9f75a7cf85d416eac71cc2d6f668132c2b6a3ae6a12075555c postgis-1.3.1.tar.gz 2148125
diff --git a/dev-db/postgis/postgis-1.2.1.ebuild b/dev-db/postgis/postgis-1.2.1.ebuild
new file mode 100644
index 000000000000..a4bcf76b36e3
--- /dev/null
+++ b/dev-db/postgis/postgis-1.2.1.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.2.1.ebuild,v 1.1 2007/10/17 13:30:36 djay Exp $
+
+inherit autotools eutils versionator
+
+KEYWORDS="~x86 ~ppc ~amd64"
+
+DESCRIPTION="Geographic Objects for PostgreSQL"
+HOMEPAGE="http://postgis.refractions.net"
+SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="geos proj doc"
+
+RDEPEND=">=dev-db/postgresql-7.4
+ geos? ( sci-libs/geos )
+ proj? ( sci-libs/proj )"
+
+DEPEND="${RDEPEND}
+ doc? ( app-text/docbook-xsl-stylesheets )"
+
+RESTRICT="test"
+
+pkg_setup(){
+ local tmp
+ tmp="$(portageq match / postgis | cut -d'.' -f2)"
+ if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
+ elog "You must soft upgrade your existing postgis enabled databases"
+ elog "using 'emerge --config postgis'."
+ require_soft_upgrade="1"
+ ebeep 2
+ fi
+}
+
+src_unpack(){
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${PN}_xsl.patch"
+
+ eautoconf
+}
+
+src_compile(){
+ local myconf
+ if use geos; then
+ myconf="--with-geos"
+ fi
+
+ if use doc;then
+ myconf="${myconf} --with-xsl=$(ls "${ROOT}"usr/share/sgml/docbook/* | \
+ grep xsl\- | cut -d':' -f1)"
+ fi
+
+ econf --enable-autoconf \
+ --datadir=/usr/share/postgresql/contrib/ \
+ --libdir=/usr/$(get_libdir)/postgresql/ \
+ --with-docdir=/usr/share/doc/${PF}/html/ \
+ ${myconf} \
+ $(use_with proj) ||\
+ die "Error: econf failed"
+
+ emake || die "Error: emake failed"
+
+ cd topology/
+ emake || die "Unable to build topology sql file"
+
+ if use doc ; then
+ cd "${S}"
+ emake docs || die "Unable to build documentation"
+ fi
+}
+
+src_install(){
+ dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
+ emake DESTDIR="${D}" install || die "emake install failed"
+ cd "${S}/topology/"
+ emake DESTDIR="${D}" install || die "emake install topology failed"
+
+ cd "${S}"
+ dodoc Changelog CREDITS TODO loader/README.* doc/*txt
+
+ docinto topology
+ dodoc topology/{TODO,README}
+ dobin ./utils/postgis_restore.pl
+
+ cd "${S}"
+ if use doc; then
+ emake DESTDIR="${D}" docs-install || die "emake install docs failed"
+ fi
+
+ if [ ! -z "${require_soft_upgrade}" ]; then
+ grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql |\
+ grep -v "'sql'" > \
+ "${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
+ fi
+}
+
+pkg_postinst() {
+ elog "To create new spatial database use 'emerge --config ${PN}.'"
+}
+
+pkg_config(){
+ PGUSER="${PGUSER:-postgres}"
+ PGDATABASE="${PGDATABASE:-template_postgis}"
+
+ is_template=false
+ if [ "${PGDATABASE:0:8}" == "template" ];then
+ is_template=true
+ mytype="template database"
+ else
+ mytype="database"
+ fi
+
+ einfo "Create or upgrade a spatial template and database."
+ einfo "Using the user ${PGUSER} and the ${PGDATABASE} ${mytype}."
+ einfo "Please do 'export PGUSER=...' to use another user."
+ einfo "Please do 'export PGDATABASE=...' to set another template/database"
+ einfo "name (templates name have to be prefixed with 'template')."
+
+ logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
+ safe_exit(){
+ eerror "Removing created ${mydb} ${mytype}"
+ dropdb -q || (eerror "${1}"
+ die "Removing old db failed, you must do it manually")
+ eerror "Please see ${logfile} for more information."
+ die "${1}"
+ }
+
+ # if there is not a table or a template existing with the same name, create.
+ psql -ql 2> ${logfile}
+ if [ "$?" == 2 ];then
+ die "Unable to access databases server using the ${PGUSER} user"
+ fi
+ PGDBS="$(psql template1 -Atc \
+ 'select 1 from pg_tables where tablename=${PGDATABASE};')"
+ if [ "$(psql -l | grep "${PGDATABASE}")" != 1 ]; then
+ einfo
+ einfo "Please hit ENTER if you want to create the ${PGDATABASE}"
+ einfo "${mytype} as "${PGUSER}" user, or Control-C to abort now..."
+ read
+ einfo "Creating the ${mytype} ${PGDATABASE}."
+ createdb -q -O ${PGUSER} ||\
+ die "Unable to create the ${mydb} ${mytype} as ${myuser}"
+ createlang plpgsql
+ if [ "$?" == 2 ]; then
+ safe_exit "${myuser} not allowed to createlang plpgsql ${mydb}."
+ fi
+ einfo "Loading PostGIS files into ${PGDATABASE}."
+ (psql -q -f \
+ "${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
+ psql -q -f \
+ "${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
+ "${logfile}"
+ if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
+ safe_exit "Unable to load the sql files."
+ fi
+ if ${is_template}; then
+ einfo "Configure ${PGDATABASE} as a ${mytype}"
+ psql -q -c \
+ "UPDATE pg_database SET datistemplate=TRUE, datallowconn=FALSE
+ WHERE datname = '${PGDATABASE}';
+ VACUUM FREEZE;" || die "Unable to create ${mydb}"
+ fi
+ else
+ einfo
+ einfo "Please hit ENTER if you want to upgrade the ${mydb}"
+ einfo "${mytype} as ${myuser} user, or Control-C to abort now..."
+ read
+ if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
+ then
+ einfo "Updating the dynamic library references"
+ psql -q -f \
+ "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
+ 2> "${logfile}"
+ if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
+ safe_exit "Unable to update references."
+ fi
+ fi
+ if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
+ then
+ einfo "Running soft upgrade"
+ psql -q -f \
+ "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
+ "${logfile}"
+ if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
+ safe_exit "Unable to run soft upgrade."
+ fi
+ fi
+ fi
+
+ if ${is_template}; then
+ einfo "You can now create a spatial database using :"
+ einfo "createdb -T ${PGDATABASE} <db_name>"
+ fi
+}
diff --git a/dev-db/postgis/postgis-1.3.1.ebuild b/dev-db/postgis/postgis-1.3.1.ebuild
new file mode 100644
index 000000000000..f9235a791732
--- /dev/null
+++ b/dev-db/postgis/postgis-1.3.1.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.3.1.ebuild,v 1.1 2007/10/17 13:30:36 djay Exp $
+
+inherit autotools eutils versionator
+
+KEYWORDS="~x86 ~ppc ~amd64"
+
+DESCRIPTION="Geographic Objects for PostgreSQL"
+HOMEPAGE="http://postgis.refractions.net"
+SRC_URI="http://www.postgis.org/download/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="geos proj doc"
+
+RDEPEND=">=dev-db/postgresql-7.4
+ geos? ( sci-libs/geos )
+ proj? ( sci-libs/proj )"
+
+DEPEND="${RDEPEND}
+ doc? ( app-text/docbook-xsl-stylesheets )"
+
+RESTRICT="test"
+
+pkg_setup(){
+ local tmp
+ tmp="$(portageq match / postgis | cut -d'.' -f2)"
+ if [ "${tmp}" != "$(get_version_component_range 2)" ]; then
+ elog "You must soft upgrade your existing postgis enabled databases"
+ elog "using 'emerge --config postgis'."
+ require_soft_upgrade="1"
+ ebeep 2
+ fi
+}
+
+src_compile(){
+ local myconf
+ if use geos; then
+ myconf="--with-geos"
+ fi
+
+ if use doc;then
+ myconf="${myconf} --with-xsl=$(ls "${ROOT}"usr/share/sgml/docbook/* | \
+ grep xsl\- | cut -d':' -f1)"
+ fi
+
+ econf --enable-autoconf \
+ --datadir=/usr/share/postgresql/contrib/ \
+ --libdir=/usr/$(get_libdir)/postgresql/ \
+ --with-docdir=/usr/share/doc/${PF}/html/ \
+ ${myconf} \
+ $(use_with proj) ||\
+ die "Error: econf failed"
+
+ emake || die "Error: emake failed"
+
+ cd topology/
+ emake || die "Unable to build topology sql file"
+
+ if use doc ; then
+ cd "${S}"
+ emake docs || die "Unable to build documentation"
+ fi
+}
+
+src_install(){
+ dodir /usr/$(get_libdir)/postgresql /usr/share/postgresql/contrib/
+ emake DESTDIR="${D}" install || die "emake install failed"
+ cd "${S}/topology/"
+ emake DESTDIR="${D}" install || die "emake install topology failed"
+
+ cd "${S}"
+ dodoc Changelog CREDITS TODO loader/README.* doc/*txt
+
+ docinto topology
+ dodoc topology/{TODO,README}
+ dobin ./utils/postgis_restore.pl
+
+ cd "${S}"
+ if use doc; then
+ emake DESTDIR="${D}" docs-install || die "emake install docs failed"
+ fi
+
+ if [ ! -z "${require_soft_upgrade}" ]; then
+ grep "'C'" -B 4 "${D}"usr/share/postgresql/contrib/lwpostgis.sql |\
+ grep -v "'sql'" > \
+ "${D}"usr/share/postgresql/contrib/load_before_upgrade.sql
+ fi
+}
+
+pkg_postinst() {
+ elog "To create new spatial database use 'emerge --config ${PN}.'"
+}
+
+pkg_config(){
+ myuser="${PG_USER:-postgres}"
+ mydb="${PGDATABASE:-template_gis}"
+
+ is_template=false
+ if [ "${mydb:0:8}" == "template" ];then
+ is_template=true
+ mytype="template database"
+ else
+ mytype="database"
+ fi
+
+ einfo "Create or upgrade a spatial template and database."
+ einfo "Using the user ${myuser} and the ${mydb} ${mytype}."
+ einfo "Please do 'export PG_USER=...' to use another user."
+ einfo "Please do 'export PGDATABASE=...' to set another template/database"
+ einfo "name (templates name have to be prefixed with 'template')."
+
+ logfile=$(mktemp "${ROOT}tmp/error.log.XXXXXX")
+ safe_exit(){
+ eerror "Removing created ${mydb} ${mytype}"
+ dropdb -q -U "${myuser}" "${mydb}" ||\
+ (eerror "${1}"
+ die "Removing old db failed, you must do it manually")
+ eerror "Please read ${logfile} for more information."
+ die "${1}"
+ }
+
+ # if there is not a table or a template existing with the same name, create.
+ if [ -z "$(psql -U "${myuser}" -l | grep "${mydb}")" ]; then
+ einfo
+ einfo "Please hit ENTER if you want to create the ${mydb}"
+ einfo "${mytype} as "${myuser}" user, or Control-C to abort now..."
+ read
+ createdb -q -O ${myuser} -U ${myuser} ${mydb} ||\
+ die "Unable to create the ${mydb} ${mytype} as ${myuser}"
+ createlang -U ${myuser} plpgsql ${mydb}
+ if [ "$?" == 2 ]; then
+ safe_exit "Unable to createlang plpgsql ${mydb}."
+ fi
+ (psql -q -U ${myuser} ${mydb} -f \
+ "${ROOT}"usr/share/postgresql/contrib/lwpostgis.sql &&
+ psql -q -U ${myuser} ${mydb} -f \
+ "${ROOT}"usr/share/postgresql/contrib/spatial_ref_sys.sql) 2>\
+ "${logfile}"
+ if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
+ safe_exit "Unable to load sql files."
+ fi
+ if ${is_template}; then
+ psql -q -U ${myuser} ${mydb} -c \
+ "UPDATE pg_database SET datistemplate = TRUE
+ WHERE datname = '${mydb}';
+ GRANT ALL ON table spatial_ref_sys, geometry_columns TO PUBLIC;
+ VACUUM FREEZE;" || die "Unable to create ${mydb}"
+ fi
+ else
+ einfo
+ einfo "Please hit ENTER if you want to upgrade the ${mydb}"
+ einfo "${mytype} as ${myuser} user, or Control-C to abort now..."
+ read
+ if [ -e "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql ];
+ then
+ einfo "Updating the dynamic library references"
+ psql -q -U ${myuser} ${mydb} -f \
+ "${ROOT}"usr/share/postgresql/contrib/load_before_upgrade.sql\
+ 2> "${logfile}"
+ if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
+ safe_exit "Unable to update references."
+ fi
+ fi
+ if [ -e "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql ];
+ then
+ einfo "Running soft upgrade"
+ psql -q -U ${myuser} ${mydb} -f \
+ "${ROOT}"usr/share/postgresql/contrib/lwpostgis_upgrade.sql 2>\
+ "${logfile}"
+ if [ "$(grep -c ERROR "${logfile}")" \> 0 ]; then
+ safe_exit "Unable to run soft upgrade."
+ fi
+ fi
+ fi
+
+ if ${is_template}; then
+ einfo "You can now create a spatial database using :"
+ einfo "'createdb -T ${mydb} test'"
+ fi
+}