aboutsummaryrefslogtreecommitdiffstats
path: root/community
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-07-26 21:57:08 +0200
committerJakub Jirutka <jakub@jirutka.cz>2018-07-27 15:30:37 +0200
commit206957b0ed543128ee91fff31747561be1dd38c1 (patch)
tree91a594517432b603dcf6d9ccbd345508af3a63ea /community
parent80365694380bab5540e0914748b200f53133ee8b (diff)
downloadaports-206957b0ed543128ee91fff31747561be1dd38c1.tar.bz2
aports-206957b0ed543128ee91fff31747561be1dd38c1.tar.xz
community/roundcubemail: add subpackage for each supported DB
Diffstat (limited to 'community')
-rw-r--r--community/roundcubemail/APKBUILD28
-rw-r--r--community/roundcubemail/roundcubemail-pgsql.post-install12
2 files changed, 39 insertions, 1 deletions
diff --git a/community/roundcubemail/APKBUILD b/community/roundcubemail/APKBUILD
index 7a53cb8fbc..540f486abd 100644
--- a/community/roundcubemail/APKBUILD
+++ b/community/roundcubemail/APKBUILD
@@ -33,7 +33,7 @@ pkgusers="roundcube"
pkggroups="$pkgusers"
options="!check" # no tests provided
install="$pkgname.pre-install $pkgname.post-install $pkgname.post-upgrade
- $pkgname-openrc.post-install"
+ $pkgname-openrc.post-install $pkgname-pgsql.post-install"
subpackages="$pkgname-installer $pkgname-openrc $pkgname-doc"
source="https://github.com/roundcube/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.gz
fix-dirs.patch
@@ -52,6 +52,10 @@ builddir="$srcdir/$pkgname-$pkgver"
# 1.2.5-r0:
# - CVE-2017-8114
+for _db in mssql mysql pgsql sqlite; do
+ subpackages="$subpackages $pkgname-$_db:_db"
+done
+
_destdir="usr/share/webapps/roundcube"
prepare() {
@@ -66,6 +70,9 @@ prepare() {
# cleanup
sed -i 's/\r//' SQL/mssql.initial.sql
rm -rf logs temp
+
+ # Useless 'cause there's no FOSS PDO driver.
+ rm -R SQL/oracle*
}
package() {
@@ -112,6 +119,25 @@ openrc() {
install -m 700 -o roundcube -g roundcube -d "$subpkgdir"/var/tmp/roundcube
}
+_db() {
+ local subname=${subpkgname#$pkgname-}
+ local driver="$subname"
+ local rcname="$subname"
+ local desc
+
+ case "$subname" in
+ mssql) desc="MS SQL" driver=dblib;;
+ mysql) desc="MariaDB";;
+ pgsql) desc="PostgreSQL" rcname="postgres";;
+ sqlite) desc="SQLite";;
+ esac
+
+ pkgdesc="$pkgdesc ($desc DB)"
+ depends="$pkgname=$pkgver-r$pkgrel $_php-pdo_${driver}"
+
+ _mv "$pkgdir"/$_destdir/SQL/$rcname* "$subpkgdir"/$_destdir/SQL/
+}
+
_mv() {
local dest; for dest; do true; done # get last argument
mkdir -p "$dest"
diff --git a/community/roundcubemail/roundcubemail-pgsql.post-install b/community/roundcubemail/roundcubemail-pgsql.post-install
new file mode 100644
index 0000000000..f46ba5b3e2
--- /dev/null
+++ b/community/roundcubemail/roundcubemail-pgsql.post-install
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cat >&2 <<EOF
+*
+* Create database for Roundcube and load the initialization script:
+*
+* su -l postgres
+* psql -c "CREATE ROLE roundcube PASSWORD 'top-secret' INHERIT LOGIN;"
+* psql -c "CREATE DATABASE roundcube OWNER roundcube ENCODING 'UTF-8';"
+* psql -U roundcube roundcube < /usr/share/webapps/roundcube/SQL/postgres.initial.sql
+*
+EOF