Only manage access rules for MyPLC databses (planetlab5 and drupal). Ignore access...
[plcapi.git] / plc.d / postgresql
index 4f986e6..3b77e53 100755 (executable)
@@ -70,8 +70,15 @@ case "$1" in
        # PostgreSQL must be started at least once to bootstrap
        # /var/lib/pgsql/data
        if [ ! -f $postgresql_conf ] ; then
-           service postgresql initdb &> /dev/null || :
-           check
+# fedora 16 uses systemd
+# http://docs.fedoraproject.org/en-US/Fedora/16/html/Release_Notes/sect-Release_Notes-Changes_for_Sysadmin.html            
+           if type postgresql-setup >& /dev/null ; then
+               postgresql-setup initdb || :
+               check
+           else
+               service postgresql initdb &> /dev/null || postgresql :
+               check
+           fi
        fi
 
        ######## /var/lib/pgsql/data/postgresql.conf
@@ -85,8 +92,8 @@ case "$1" in
        echo "timezone='UTC'" >> $postgresql_conf
 
        ######## /var/lib/pgsql/data/pg_hba.conf
-       # Disable access to all DBs from all hosts
-       sed -i -e '/^\(host\|local\)/d' $pghba_conf
+    # Disable access to MyPLC and drupal DBs from all hosts
+    sed -i -e '/^\(host\|local\)\s\($PLC_DB_NAME\|drupal\)/d' $pghba_conf
 
        # Enable passwordless localhost access
        echo "local all all trust" >>$pghba_conf