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
|
$NetBSD: patch-aa,v 1.4 2019/11/03 14:05:19 triaxx Exp $
Set pkgsrc AWLDIR.
--- dba/create-database.sh.orig 2019-01-30 21:53:08.000000000 +0000
+++ dba/create-database.sh
@@ -12,7 +12,7 @@ INSTALL_NOTE_FN="`mktemp -t tmp.XXXXXXXX
# Candidate locations of the AWL directory
-awldirs="${DBADIR}/../../awl
+awldirs="@LIBAWLPATH@
/usr/share/awl
/usr/share/php/awl
/usr/local/share/awl"
@@ -41,19 +41,19 @@ AWL_APPUSER="${4:-davical_app}"
# set -x
# Get the major version for PostgreSQL
-export DBVERSION="`psql -qXAt ${PSQLOPTS} -c "SELECT version();" template1 | cut -f2 -d' ' | cut -f1-2 -d'.'`"
+export DBVERSION="`psql -U @PGUSER@ -qXAt ${PSQLOPTS} -c "SELECT version();" template1 | cut -f2 -d' ' | cut -f1-2 -d'.'`"
install_note() {
cat >>"${INSTALL_NOTE_FN}"
}
db_users() {
- psql -qXAt ${PSQLOPTS} -c "SELECT usename FROM pg_user;" template1
+ psql -U @PGUSER@ -qXAt ${PSQLOPTS} -c "SELECT usename FROM pg_user;" template1
}
create_db_user() {
if ! db_users | grep "^${1}$" >/dev/null ; then
- psql -qXAt ${PSQLOPTS} -c "CREATE USER ${1} NOCREATEDB NOCREATEROLE;" template1
+ psql -U @PGUSER@ -qXAt ${PSQLOPTS} -c "CREATE USER ${1} NOCREATEDB NOCREATEROLE;" template1
cat <<EONOTE | install_note
* You will need to edit the PostgreSQL pg_hba.conf to allow the
'${1}' database user access to the 'davical' database.
@@ -79,7 +79,7 @@ create_db_user "${AWL_DBAUSER}"
create_db_user "${AWL_APPUSER}"
# FIXME: Need to check that the database was actually created.
-if ! createdb --encoding UTF8 --template template0 --owner "${AWL_DBAUSER}" ${PSQLOPTS} "${DBNAME}" ; then
+if ! createdb --username=@PGUSER@ --encoding UTF8 --template template0 --owner "${AWL_DBAUSER}" ${PSQLOPTS} "${DBNAME}" ; then
echo "Unable to create database"
exit 1
fi
@@ -95,8 +95,8 @@ else
if try_db_user "${USER}" ; then
export DBA=""
else
- if try_db_user "${PGUSER}" ; then
- export DBA=""
+ if try_db_user "@PGUSER@" ; then
+ export DBA="-U @PGUSER@"
else
cat <<EOFAILURE
* * * * ERROR * * * *
@@ -184,7 +184,7 @@ rm "${INSTALL_NOTE_FN}"
cat <<FRIENDLY
* The password for the 'admin' user has been set to '${ADMINPW}'
-Thanks for trying DAViCal! Check the configuration in /etc/davical/config.php.
+Thanks for trying DAViCal! Check the configuration in @PKG_SYSCONFDIR@/config.php.
For help, look at our website and wiki, or visit #davical on irc.oftc.net.
FRIENDLY
|