blob: 67401e266678005baa3484a05f0cde3c063c8ce3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
# $FreeBSD$
#
# This script prepares a sample PostgreSQL database
# for use by OpenACS
#
PGUSER=%%PGUSER%%
OPENACS_USER=%%OPENACS_USER%%
OPENACS_DB=%%OPENACS_DB%%
LOCALBASE=%%LOCALBASE%%
#
PGREP=/usr/bin/pgrep
SU=/usr/bin/su
AWK=/usr/bin/awk
CREATEUSERFLAGS="-A -d"
# Check if PostgreSQL version is >= 8.1.0
${LOCALBASE}/bin/postmaster -V | ${AWK} -F '[ .]' '{if ($3==8 && $4>=1) {exit 0} else {exit 1}}' && {
POSTGRESQL81=YES
CREATEUSERFLAGS="-S -R -d"
}
${PGREP} -U ${PGUSER} postgres > /dev/null || {
echo "You need PostgreSQL server installed and running."
echo "After a fresh install, you need to initialize the database with:"
echo "su - ${PGUSER} -c initdb"
echo "Exiting ..."
exit 1
}
echo "Creating PostgreSQL user ${OPENACS_USER} ..."
${SU} -l ${PGUSER} -c "${LOCALBASE}/bin/createuser ${CREATEUSERFLAGS} ${OPENACS_USER}"
echo "Creating PostgreSQL database ${OPENACS_DB} ..."
${SU} -l ${OPENACS_USER} -c "${LOCALBASE}/bin/createdb -E UNICODE ${OPENACS_DB}"
echo "Registering language plpgsql for database ${OPENACS_DB} ..."
${SU} -l ${PGUSER} -c "${LOCALBASE}/bin/createlang plpgsql ${OPENACS_DB}"
[ "x${POSTGRESQL81}" = "xYES" ] && {
echo ""
echo "**************************** NOTICE ****************************"
echo "You have PostgreSQL 8.1 or greater installed."
echo "Your may need to alter your PostgreSQL configuration."
echo "Please read the instructions under the following URL:"
echo "http://openacs.org/xowiki/How_to_install_in_Postgres_8.x"
echo "****************************************************************"
}
|