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

Use "CREATE EXTENSION postgis; ..." on Ubuntu trusty #156

Merged
merged 1 commit into from
Jan 23, 2015
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
14 changes: 13 additions & 1 deletion bin/install-as-user
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,19 @@ fi
echo -n "Setting up database... "
if ! psql -l | egrep "^ *$DB_NAME *\|" > /dev/null
then
createdb -T template_postgis --owner "$UNIX_USER" "$DB_NAME"
if [ trusty = "$(lsb_release -s -c)" ]
then
# Currently the only supported distribution where we can just
# use CREATE EXTENSION to make this a PostGIS database is on
# Ubuntu trusty:
createdb --owner "$UNIX_USER" "$DB_NAME"
COMMAND="CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;"
psql -c "$COMMAND" "$DB_NAME"
else
# Otherwise, the template_postgis template should already
# have been created.
createdb -T template_postgis --owner "$UNIX_USER" "$DB_NAME"
fi
fi

conf/post_deploy_actions.bash
15 changes: 14 additions & 1 deletion bin/site-specific-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,25 @@ install_website_packages

install_postgis

add_postgresql_user
if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"trusty" ]
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:
add_postgresql_user --superuser
else
add_postgresql_user
fi

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" ]
then
sudo -u postgres psql -c "ALTER USER $UNIX_USER WITH NOSUPERUSER"
fi

install_sysvinit_script

add_website_to_nginx
Expand Down