Add is_fedora and exit_distro_not_supported functions
Between is_fedora, is_ubuntu and is_suse, we can make the code a bit
simpler to read. We also use exit_distro_not_supported to identify
places where we need implementation details for new distros.
As "/sbin/service --skip-redirect" is Fedora-specific, guard this with a
is_fedora test too.
Change-Id: Ic77c0697ed9be0dbb5df8e73da93463e76025f0c
diff --git a/lib/databases/postgresql b/lib/databases/postgresql
index d9c2f00..20ade85 100644
--- a/lib/databases/postgresql
+++ b/lib/databases/postgresql
@@ -20,7 +20,7 @@
function configure_database_postgresql {
echo_summary "Configuring and starting PostgreSQL"
- if [[ "$os_PACKAGE" = "rpm" ]]; then
+ if is_fedora || is_suse; then
PG_HBA=/var/lib/pgsql/data/pg_hba.conf
PG_CONF=/var/lib/pgsql/data/postgresql.conf
sudo [ -e $PG_HBA ] || sudo postgresql-setup initdb
@@ -53,10 +53,12 @@
else
sed -i "s/:root:\w\+/:root:$DATABASE_PASSWORD/" $PGPASS
fi
- if [[ "$os_PACKAGE" = "rpm" ]]; then
+ if is_ubuntu; then
+ install_package postgresql
+ elif is_fedora || is_suse; then
install_package postgresql-server
else
- install_package postgresql
+ exit_distro_not_supported "postgresql installation"
fi
}