3 #=======================================================================
5 # File ID: 4467f922-5330-11e5-814f-fefdb24f8e10
7 # Compile and install PostGIS
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname
=build-postgis
16 srcdir
="$HOME/src/other/postgis"
27 " -n "$progname" -- "$@
")"
28 test "$?" = "0" ||
exit 1
36 -h|
--help) opt_help
=1; shift ;;
37 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
38 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
39 --version) echo $progname $VERSION; exit 0 ;;
41 *) echo $progname: Internal error
>&2; exit 1 ;;
44 opt_verbose
=$
(($opt_verbose - $opt_quiet))
46 if test "$opt_help" = "1"; then
47 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
50 Compile and install PostGIS from $srcdir
52 Usage: $progname [options]
59 Be more quiet. Can be repeated to increase silence.
61 Increase level of verbosity. Can be repeated.
63 Print version information.
71 echo $progname: $
* >&2
74 if ! test -d "$srcdir/."; then
75 git clone
-o o-gitlab git@gitlab.com
:postgis
/postgis.git
$srcdir &&
77 git remote add o-github git@github.com
:postgis
/postgis.git
&&
80 echo $progname: No stable version is selected
, you have to choose one.
&&
81 echo $progname: Dropping you into a bash shell
, please take care of that
&&
82 echo $progname: and
return to the build with
\'exit\'.
&&
84 echo $progname: List of newest tags
: &&
86 git tag
--sort=version
:refname |
grep -E '^[2-9]' |
tail &&
88 echo $progname: Continuing the build process... ||
{
89 echo $progname: Something went wrong after clone or shell
, aborting
94 tmpdb
=postgis-test-$
(date +%s
)
97 git-wait-until-clean
&&
98 msg Remove ignored files from $
(pwd)/ &&
108 msg Test that the installation works
&&
109 sudo
-u postgres createdb
"$tmpdb" &&
110 sudo
-u postgres psql
"$tmpdb" -c "CREATE EXTENSION postgis;" &&
111 sudo
-u postgres dropdb
"$tmpdb" && {
112 msg PostGIS installation ok
115 msg Cannot create postgis extension
, something is wrong