git://git.onelab.eu
/
myplc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
19b2e23
)
- bootstrap Drupal DB
author
Mark Huang
<mlhuang@cs.princeton.edu>
Fri, 27 Oct 2006 20:29:20 +0000
(20:29 +0000)
committer
Mark Huang
<mlhuang@cs.princeton.edu>
Fri, 27 Oct 2006 20:29:20 +0000
(20:29 +0000)
plc.d/postgresql
patch
|
blob
|
history
diff --git
a/plc.d/postgresql
b/plc.d/postgresql
index
11f7da5
..
de722c8
100755
(executable)
--- a/
plc.d/postgresql
+++ b/
plc.d/postgresql
@@
-7,7
+7,7
@@
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: postgresql,v 1.4
2006/06/23 20:29:2
2 mlhuang Exp $
+# $Id: postgresql,v 1.4
.2.3 2006/08/21 21:21:1
2 mlhuang Exp $
#
# Source function library and configuration
#
# Source function library and configuration
@@
-96,6
+96,8
@@
case "$1" in
(
echo "host $PLC_DB_NAME $PLC_DB_USER $PLC_API_IP/32 password"
echo "host $PLC_DB_NAME $PLC_DB_USER $PLC_WWW_IP/32 password"
(
echo "host $PLC_DB_NAME $PLC_DB_USER $PLC_API_IP/32 password"
echo "host $PLC_DB_NAME $PLC_DB_USER $PLC_WWW_IP/32 password"
+ # Drupal also uses PostgreSQL
+ echo "host drupal $PLC_DB_USER $PLC_WWW_IP/32 password"
) >>$pghba_conf
# Fix ownership (sed -i changes it)
) >>$pghba_conf
# Fix ownership (sed -i changes it)
@@
-115,12
+117,19
@@
case "$1" in
else
psql -U postgres -c "ALTER USER $PLC_DB_USER WITH PASSWORD '$PLC_DB_PASSWORD'" template1
fi
else
psql -U postgres -c "ALTER USER $PLC_DB_USER WITH PASSWORD '$PLC_DB_PASSWORD'" template1
fi
+ check
- # Create the database if necessary
+ # Create the database
s
if necessary
if ! psql -U $PLC_DB_USER -c "" $PLC_DB_NAME >/dev/null 2>&1 ; then
createdb -U postgres $PLC_DB_NAME
if ! psql -U $PLC_DB_USER -c "" $PLC_DB_NAME >/dev/null 2>&1 ; then
createdb -U postgres $PLC_DB_NAME
- psql -U $PLC_DB_USER -f /usr/share/pl_db/plc_schema_3.sql $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
+ psql -U $PLC_DB_USER -f /var/www/html/database/database.pgsql drupal
fi
fi
+ check
result "$MESSAGE"
;;
result "$MESSAGE"
;;