pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/davical davical: fix dba/create-database.sh script



details:   https://anonhg.NetBSD.org/pkgsrc/rev/20902763a0d5
branches:  trunk
changeset: 417063:20902763a0d5
user:      triaxx <triaxx%pkgsrc.org@localhost>
date:      Sun Nov 03 14:05:19 2019 +0000

description:
davical: fix dba/create-database.sh script

pkgsrc changes:
  * Fix the script that initialize PostgreSQL database. Patch for AWL
    directory was broken. Add '-U @PGUSER@' to psql command because it
    is the default database administrator out of the box.
  * Bump revision.

diffstat:

 www/davical/Makefile         |  12 ++++++++--
 www/davical/distinfo         |   4 +-
 www/davical/patches/patch-aa |  49 +++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 57 insertions(+), 8 deletions(-)

diffs (120 lines):

diff -r 8dc68a1c9627 -r 20902763a0d5 www/davical/Makefile
--- a/www/davical/Makefile      Sun Nov 03 12:40:51 2019 +0000
+++ b/www/davical/Makefile      Sun Nov 03 14:05:19 2019 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.38 2019/09/20 07:45:21 triaxx Exp $
+# $NetBSD: Makefile,v 1.39 2019/11/03 14:05:19 triaxx Exp $
 
 DISTNAME=      davical-${DAVICAL_VERSION}
 PKGNAME=       ${PHP_PKG_PREFIX}-davical-${DAVICAL_VERSION}
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    www
 MASTER_SITES=  -https://gitlab.com/davical-project/davical/repository/archive.tar.gz?ref=${GITLAB_TAG}
 
@@ -85,7 +85,7 @@
 SUBST_CLASSES+=                inc-path
 SUBST_STAGE.inc-path=  pre-configure
 SUBST_VARS.inc-path+=  PKG_SYSCONFDIR
-SUBST_FILES.inc-path=  davical.conf inc/always.php.in
+SUBST_FAWLDIRILES.inc-path=    davical.conf inc/always.php.in
 SUBST_FILES.inc-path+= scripts/po/rebuild-translations.sh
 SUBST_FILES.inc-path+= dba/create-database.sh
 SUBST_SED.inc-path+=   -e "s|@LIBAWLPATH@|${PREFIX}/${LIBAWLDIR}|g"
@@ -103,6 +103,12 @@
 SUBST_FILES.files=     davical.conf
 SUBST_MESSAGE.files=   Fixing DAViCal configuration file for Apache.
 
+SUBST_CLASSES+=                postgres
+SUBST_STAGE.postgres=  pre-configure
+SUBST_VARS.postgres=   PGUSER
+SUBST_FILES.postgres=  dba/create-database.sh
+SUBST_MESSAGE.postgres=        Fixing PostgreSQL variables.
+
 pre-patch:
        ${MV} ${WRKDIR}/davical-${GITLAB_TAG}-${GITLAB_REV} ${WRKSRC}
        ${CP} ${FILESDIR}/davical.conf ${WRKSRC}/davical.conf
diff -r 8dc68a1c9627 -r 20902763a0d5 www/davical/distinfo
--- a/www/davical/distinfo      Sun Nov 03 12:40:51 2019 +0000
+++ b/www/davical/distinfo      Sun Nov 03 14:05:19 2019 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.15 2019/05/10 12:25:04 hauke Exp $
+$NetBSD: distinfo,v 1.16 2019/11/03 14:05:19 triaxx Exp $
 
 SHA1 (davical-1.1.8.tar.gz) = b42da3733fa9d92f3e43529e4b19428707c0f4a2
 RMD160 (davical-1.1.8.tar.gz) = 620e2b16220a859cca6f751c10f847dcca30f997
 SHA512 (davical-1.1.8.tar.gz) = 86987599e4e3af5b1995ad25e589a83bb1634f5c740691b9f6d7deb7dc9970019a86ffb4e0a51e91061b11ed44046a78d873ba874a78eab0700f33f70a04cd6a
 Size (davical-1.1.8.tar.gz) = 1837037 bytes
-SHA1 (patch-aa) = a2a8be1a131cd47c6541c0a0793a00a33ba3a9f2
+SHA1 (patch-aa) = 39d61a0bd2bc76d111fb7f03ea663ffac7dbd12f
 SHA1 (patch-ab) = 7ae06c595f54d3a959db481d303978b29ebbd899
 SHA1 (patch-ac) = 357abb2ad470121f3f30d19a4602692c77661872
 SHA1 (patch-ad) = ecbac45e18ed6cea2915caadfb4dca1a2ce32667
diff -r 8dc68a1c9627 -r 20902763a0d5 www/davical/patches/patch-aa
--- a/www/davical/patches/patch-aa      Sun Nov 03 12:40:51 2019 +0000
+++ b/www/davical/patches/patch-aa      Sun Nov 03 14:05:19 2019 +0000
@@ -1,18 +1,61 @@
-$NetBSD: patch-aa,v 1.3 2017/06/18 15:27:24 taca Exp $
+$NetBSD: patch-aa,v 1.4 2019/11/03 14:05:19 triaxx Exp $
 
 Set pkgsrc AWLDIR.
 
---- dba/create-database.sh.orig        2017-01-23 22:04:46.000000000 +0000
+--- 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
-+AWLDIR="@LIBAWLPATH@"
++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}'



Home | Main Index | Thread Index | Old Index