for f12
[myplc.git] / plc.d / postgresql
index 8099462..8b5739e 100755 (executable)
@@ -58,7 +58,7 @@ case "$1" in
            exit 0
        fi
 
-       MESSAGE=$"Starting database server"
+       MESSAGE=$"Starting PostgreSQL server"
        dialog "$MESSAGE"
 
        # Set data directory and redirect startup output to /var/log/pgsql
@@ -159,15 +159,13 @@ case "$1" in
 
        # Create the databases if necessary
        if ! psql -U $PLC_DB_USER -c "" $PLC_DB_NAME >/dev/null 2>&1 ; then
-           createdb -U postgres --encoding=UNICODE --owner=$PLC_DB_USER $PLC_DB_NAME
+           createdb -U postgres --template=template0 --encoding=UNICODE --owner=$PLC_DB_USER $PLC_DB_NAME
            psql -U $PLC_DB_USER -f /usr/share/plc_api/$PLC_DB_NAME.sql $PLC_DB_NAME
        fi
        check
        if ! psql -U $PLC_DB_USER -c "" drupal >/dev/null 2>&1 ; then
-           createdb -U postgres --encoding=UNICODE --owner=$PLC_DB_USER drupal
-           # when using drupal 6.x, we must not do this
-           drupal_schema=/var/www/html/database/database.pgsql
-           [ -f $drupal_schema ] && psql -U $PLC_DB_USER -f $drupal_schema drupal
+           createdb -U postgres --template=template0 --encoding=UNICODE --owner=$PLC_DB_USER drupal
+            psql -U $PLC_DB_USER -f /var/www/html/database/database.pgsql drupal 
        fi
        check
 
@@ -175,7 +173,7 @@ case "$1" in
        ;;
 
     stop)
-       MESSAGE=$"Stopping database server"
+       MESSAGE=$"Stopping PostgreSQL server"
        dialog "$MESSAGE"
 
        # Drop the current user in case the username changes