Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jessie/xenial in install scripts. #255

Merged
merged 1 commit into from
Aug 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions bin/install-as-user
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,16 @@ fi
echo -n "Setting up database... "
if ! psql -l | egrep "^ *$DB_NAME *\|" > /dev/null
then
if [ trusty = "$(lsb_release -s -c)" ]
VERSION_POSTGIS=$(dpkg-query -W -f '${Version}\n' postgresql-*-postgis*|sort -rV|head -1)
if [ 2.0 = "$(echo -e '2.0\n'$VERSION_POSTGIS | sort -V | head -1)" ]
then POSTGIS_TWO=Yes
else POSTGIS_TWO=No
fi

if [ $POSTGIS_TWO = Yes ]
then
# Currently the only supported distribution where we can just
# use CREATE EXTENSION to make this a PostGIS database is on
# Ubuntu trusty:
# If we're running PostGIS 2, we can just use CREATE EXTENSION to make
# this a PostGIS database:
createdb --owner "$UNIX_USER" "$DB_NAME"
COMMAND="CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;"
psql -c "$COMMAND" "$DB_NAME"
Expand Down
15 changes: 10 additions & 5 deletions bin/site-specific-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ install_website_packages

install_postgis

if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"trusty" ]
VERSION_POSTGIS=$(dpkg-query -W -f '${Version}\n' postgresql-*-postgis*|sort -rV|head -1)
if [ 2.0 = "$(echo -e '2.0\n'$VERSION_POSTGIS | sort -V | head -1)" ]
then POSTGIS_TWO=Yes
else POSTGIS_TWO=No
fi

if [ $POSTGIS_TWO = Yes ]
then
# On trusty, the database user will need to be a superuser so that
# it can create the PostGIS extension; we'll drop that privilege
# afterwards:
# With PostGIS 2, the database user will need to be a superuser so that it
# can create the PostGIS extension; we'll drop that privilege afterwards:
add_postgresql_user --superuser
else
add_postgresql_user
Expand All @@ -45,7 +50,7 @@ make_log_directory

su -l -c "$REPOSITORY/bin/install-as-user '$UNIX_USER' '$HOST' '$DIRECTORY'" "$UNIX_USER"

if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"trusty" ]
if [ $POSTGIS_TWO = Yes ]
then
sudo -u postgres psql -c "ALTER USER $UNIX_USER WITH NOSUPERUSER"
fi
Expand Down