summaryrefslogtreecommitdiff
path: root/www/openacs/files/install-openacs
blob: f4febdabe3e7f66c93a6df413a5f6ab5cded3c7f (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
# $NetBSD: install-openacs,v 1.1.1.1 2001/07/19 04:36:06 cjones Exp $
PATH=/bin:/usr/bin:@PREFIX@/bin

# Script to copy the openacs tree, create db, and populate db.

while [ `expr "$1" : -.*` -ne 0 ] ; do
    case "$1" in
    "-u")
	ACSUSER=$2
	shift;shift
	;;
    "-d")
	ACSDB=$2
	shift;shift
	;;
    *)
	echo "Usage: $0 -u dbuser -d dbname destpath"
	echo "dbuser is the postgres user, dbname is the database name."
	echo "destpath is the path to install OpenACS in."
	exit 1
	;;
    esac
done
DEST=$1

if [ -z "$DEST" ] ; then
    echo "No destination given!"
    exit 1
fi
if [ -z "$ACSUSER" ] ; then
    echo "No dbuser given!"
    exit 1
fi
if [ -z "$ACSDB" ] ; then
    echo "No dbname given!"
    exit 1
fi

echo -n "copying the openacs tree to $DEST..."
if [ ! -d $DEST ] ; then
    mkdir -p $DEST
fi
( cd @PREFIX@/share/openacs ; tar cf - . ) | \
    ( cd $DEST ; tar xf - )
if [ $? -ne 0 ] ; then
    exit 1
fi

echo "done."

NAME=`basename $DEST`
mv $DEST/parameters/ad.tcl $DEST/parameters/$NAME.tcl
rm $DEST/parameters/ad.ini

echo ""
echo "Creating $ACSDB owned by $ACSUSER:"
PGUSER=$ACSUSER
export PGUSER
psql -q -c "create database $ACSDB" template1 || exit 1

echo ""
echo "Loading geo tables:"
for I in $DEST/www/install/acs_geo_parents.sql $DEST/www/install/*.ctl ; do
    psql -q -f $I $ACSDB || exit 1
done

echo ""
echo "Loading OpenACS schema:"
cd $DEST/www/doc/sql
psql -q -f load-data-model.sql $ACSDB || exit 1

echo "done."
echo ""
echo "Don't forget to take a look at $DEST/parameters/$NAME.tcl"
echo "and @PREFIX@/etc/httpd/tcl_modules/nsd.tcl."
echo "You'll at least want to check the database info in the latter file,"
echo "and the homedir variable in both files."