aboutsummaryrefslogtreecommitdiffstats
path: root/www/openacs/files
diff options
context:
space:
mode:
Diffstat (limited to 'www/openacs/files')
-rw-r--r--www/openacs/files/adjust_pgsql_conf.sh.in74
-rw-r--r--www/openacs/files/create_sampledb.sh.in42
-rw-r--r--www/openacs/files/pkg-deinstall.in12
-rw-r--r--www/openacs/files/pkg-message.in32
4 files changed, 122 insertions, 38 deletions
diff --git a/www/openacs/files/adjust_pgsql_conf.sh.in b/www/openacs/files/adjust_pgsql_conf.sh.in
new file mode 100644
index 00000000000..8674e5b9a03
--- /dev/null
+++ b/www/openacs/files/adjust_pgsql_conf.sh.in
@@ -0,0 +1,74 @@
+#!/bin/sh
+# $FreeBSD$
+#
+# This script modifies the default "postgresql.conf" in PostgreSQL 8.1 and 8.2
+# installations, to suit the needs of OpenACS / .LRN
+#
+# Manual instructions:
+# http://openacs.org/xowiki/How_to_install_in_Postgres_8.x
+#
+# Usage: adjust_pgsql_conf.sh [path_to_postgresql.conf]
+#
+PGUSER=%%PGUSER%%
+LOCALBASE=%%LOCALBASE%%
+#
+AWK=%%AWK%%
+CP=%%CP%%
+GREP=%%GREP%%
+PW=%%PW%%
+SU=%%SU%%
+
+# Check if PostgreSQL version is >= 8.1.0
+if ! `${LOCALBASE}/bin/postmaster -V | ${AWK} -F '[ .]' '{if ($3==8 && $4>=1) {exit 0} else {exit 1}}'`; then
+ echo "You need PostgreSQL server 8.1 or higher installed."
+ exit 1
+fi
+
+# Check if user supplied a path or look for default postgresql.conf
+if [ "x${1}" = "x" ]; then
+ PGCONF=`${PW} usershow ${PGUSER} | ${AWK} -F: '{ print $9 }'`/data/postgresql.conf
+else
+ PGCONF=${1}
+fi
+
+if ! [ -f "${PGCONF}" ]; then
+ echo "ERROR: no such file: ${PGCONF}"; echo ""
+ echo "Maybe you use a different datadir or your database is not yet initialized"
+ echo "You can initialize your database with:"
+ echo "${LOCALBASE}/etc/rc.d/postgresql initdb"; echo ""
+ echo "Usage: $0 [path_to_postgresql.conf]"
+ exit 1
+fi
+
+# Very simple check if the file is a standard PostgreSQL configuration file
+if ! `${GREP} -qe '^# PostgreSQL configuration file' ${PGCONF}`; then
+ echo "ERROR: ${PGCONF} doesn't appear to be a default PostgreSQL database configuration file"
+ exit 1
+fi
+
+echo "Found ${PGCONF}"
+echo -n "Checking ... "
+
+MODIFY=no
+MISSING_FROM=no
+REGEX_FLAVOR=no
+WITH_OIDS=no
+
+# Check if we need to add anything
+if ! `${GREP} -qe '^add_missing_from = on' ${PGCONF}`; then MISSING_FROM=yes; MODIFY=yes; fi
+if ! `${GREP} -qe '^regex_flavor = extended' ${PGCONF}`; then REGEX_FLAVOR=yes; MODIFY=yes; fi
+if ! `${GREP} -qe '^default_with_oids = on' ${PGCONF}`; then WITH_OIDS=yes; MODIFY=yes; fi
+
+# Backup file and add configuration lines, if necessary
+if [ ${MODIFY} = "no" ]; then
+ echo "no modifications necessary"
+else
+ echo "needs to be modified"
+ echo "Backing up old configuration file to ${PGCONF}.bak"
+ ${CP} -p ${PGCONF} ${PGCONF}.bak
+ if [ ${MISSING_FROM} = "yes" ]; then echo "add_missing_from = on" >> ${PGCONF}; fi
+ if [ ${REGEX_FLAVOR} = "yes" ]; then echo "regex_flavor = extended" >> ${PGCONF}; fi
+ if [ ${WITH_OIDS} = "yes" ]; then echo "default_with_oids = on" >> ${PGCONF}; fi
+ echo "File successfully modified."
+ echo "Please restart your PostgreSQL server (if running)."
+fi
diff --git a/www/openacs/files/create_sampledb.sh.in b/www/openacs/files/create_sampledb.sh.in
index 67401e26667..c29987e58dc 100644
--- a/www/openacs/files/create_sampledb.sh.in
+++ b/www/openacs/files/create_sampledb.sh.in
@@ -9,37 +9,41 @@ OPENACS_USER=%%OPENACS_USER%%
OPENACS_DB=%%OPENACS_DB%%
LOCALBASE=%%LOCALBASE%%
#
-PGREP=/usr/bin/pgrep
-SU=/usr/bin/su
-AWK=/usr/bin/awk
+PGREP=%%PGREP%%
+SU=%%SU%%
+AWK=%%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"
-}
+if `${LOCALBASE}/bin/postmaster -V | ${AWK} -F '[ .]' '{if ($3==8 && $4>=1) {exit 0} else {exit 1}}'`; then
+ POSTGRESQL81=YES
+ CREATEUSERFLAGS="-S -R -d"
+fi
-${PGREP} -U ${PGUSER} postgres > /dev/null || {
+if ! `${PGREP} -U ${PGUSER} postgres > /dev/null`; then
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 "${LOCALBASE}/etc/rc.d/postgresql initdb"
echo "Exiting ..."
exit 1
-}
+fi
+
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 "****************************************************************"
-}
+
+if [ "x${POSTGRESQL81}" = "xYES" ]; then
+ echo ""
+ echo "**************************** NOTICE ****************************"
+ echo "You have PostgreSQL 8.1 or greater installed."
+ echo "Your may need to alter your PostgreSQL configuration."
+ echo "You can do this by running the supplied script:"
+ echo "%%DOCSDIR%%/adjust_pgqsl_conf.sh"; echo ""
+ echo "Alternatively you can follow the instructions at:"
+ echo "http://openacs.org/xowiki/How_to_install_in_Postgres_8.x"
+ echo "****************************************************************"
+fi
diff --git a/www/openacs/files/pkg-deinstall.in b/www/openacs/files/pkg-deinstall.in
index f7fd9c5ca14..45d415d2b88 100644
--- a/www/openacs/files/pkg-deinstall.in
+++ b/www/openacs/files/pkg-deinstall.in
@@ -8,12 +8,14 @@ fi
OPENACS_USER=%%OPENACS_USER%%
OPENACS_GROUP=%%OPENACS_GROUP%%
OPENACSBASE=%%OPENACSBASE%%
-
-if pw usershow "${OPENACS_USER}" 2>/dev/null 1>&2; then
- echo "To delete ${OPENACS_USER} user permanently, use 'pw userdel \"${OPENACS_USER}\"'"
+
+PW=%%PW%%
+
+if ${PW} usershow "${OPENACS_USER}" 2>/dev/null 1>&2; then
+ echo "To delete ${OPENACS_USER} user permanently, use '${PW} userdel \"${OPENACS_USER}\"'"
fi
-if pw usershow "${OPENACS_GROUP}" 2>/dev/null 1>&2; then
- echo "To delete ${OPENACS_GROUP} group permanently, use 'pw groupdel \"${OPENACS_GROUP}\"'"
+if ${PW} usershow "${OPENACS_GROUP}" 2>/dev/null 1>&2; then
+ echo "To delete ${OPENACS_GROUP} group permanently, use '${PW} groupdel \"${OPENACS_GROUP}\"'"
fi
if test -d "${OPENACSBASE}"; then
echo "You may need to remove ${OPENACSBASE} manually."
diff --git a/www/openacs/files/pkg-message.in b/www/openacs/files/pkg-message.in
index ca5b5d2c41b..ba6e712f5b9 100644
--- a/www/openacs/files/pkg-message.in
+++ b/www/openacs/files/pkg-message.in
@@ -1,19 +1,20 @@
Congratulations! You have just installed %%OPENACSNAME%%
-To create a sample default database, you first need a PostgreSQL server
-installed and configured on your system. If the PostgreSQL server is started
-and running, you can run the script:
-%%EXAMPLESDIR%%/create_sampledb.sh
-
-The create_sampledb.sh script works with the following servers with their
-default configurations:
-databases/postgresql74-server (7.4.x)
-databases/postgresql80-server (8.0.x)
-
-For PostgreSQL 8.1.x and 8.2.x, the database server configuration
-needs to be adjusted. Please visit the following webpage for more information:
+You need a PostgreSQL server installed and configured on your (or a on remote)
+system. We recommend using the PostgreSQL 8.2.x port located in:
+databases/postgresql82-server
+
+You may need to adjust your PostgreSQL database configuration (for servers
+v 8.1.x and higher). This can be done with the following script:
+%%DOCSDIR%%/adjust_pgsql_conf.sh
+
+If you want adjust the database configuration manually, please visit:
http://openacs.org/xowiki/How_to_install_in_Postgres_8.x
+After your local PostgreSQL server is configured and running, you can create
+a default database by running the following script:
+%%DOCSDIR%%/create_sampledb.sh
+
You can start %%OPENACSNAME%% with the startup script:
%%LOCALBASE%%/etc/rc.d/%%PORTNAME%%
@@ -21,8 +22,8 @@ If you are using another AOLserver on the default port 8000,
please change the port number in the configuration file.
Default config: %%OPENACSBASE%%/etc/%%PORTNAME%%-config.tcl
-Then use your browser to view the welcome page (http://<your-ip>:<port>)
-- default port is 8000 and follow the instructions.
+Then use your web browser to view the welcome page and follow the instructions.
+http://<your-ip>:<port> (default port is 8000)
Errors, if any, are in:
%%OPENACSBASE%%/log/error.log
@@ -30,5 +31,8 @@ Errors, if any, are in:
If you want to use keepalive via cron, you might want to look here:
%%EXAMPLESDIR%%/keepalive/
+Please visit the following webpage for more information:
+http://openacs.org/xowiki/openacs-system-install-freebsd-ports
+
-Martin Matuska
mm@FreeBSD.org