Merge pull request #58804 from Ma27/roundcube-fixes

roundcube: minor fixes
This commit is contained in:
Robin Gloster 2019-04-09 18:30:00 +00:00 committed by GitHub
commit f370553f8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 28 deletions

View file

@ -141,27 +141,31 @@ in
systemd.services.roundcube-setup = let
pgSuperUser = config.services.postgresql.superUser;
in {
requires = [ "postgresql.service" ];
after = [ "postgresql.service" ];
wantedBy = [ "multi-user.target" ];
path = [ config.services.postgresql.package ];
script = ''
mkdir -p /var/lib/roundcube
if [ ! -f /var/lib/roundcube/db-created ]; then
if [ "${cfg.database.host}" = "localhost" ]; then
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create role ${cfg.database.username} with login password '${cfg.database.password}'";
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
in mkMerge [
(mkIf (cfg.database.host == "localhost") {
requires = [ "postgresql.service" ];
after = [ "postgresql.service" ];
path = [ config.services.postgresql.package ];
})
{
wantedBy = [ "multi-user.target" ];
script = ''
mkdir -p /var/lib/roundcube
if [ ! -f /var/lib/roundcube/db-created ]; then
if [ "${cfg.database.host}" = "localhost" ]; then
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create role ${cfg.database.username} with login password '${cfg.database.password}'";
${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql postgres -c "create database ${cfg.database.dbname} with owner ${cfg.database.username}";
fi
PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
-f ${cfg.package}/SQL/postgres.initial.sql \
-h ${cfg.database.host} ${cfg.database.dbname}
touch /var/lib/roundcube/db-created
fi
PGPASSWORD=${cfg.database.password} ${pkgs.postgresql}/bin/psql -U ${cfg.database.username} \
-f ${cfg.package}/SQL/postgres.initial.sql \
-h ${cfg.database.host} ${cfg.database.dbname}
touch /var/lib/roundcube/db-created
fi
${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
'';
serviceConfig.Type = "oneshot";
};
${pkgs.php}/bin/php ${cfg.package}/bin/update.sh
'';
serviceConfig.Type = "oneshot";
}
];
};
}

View file

@ -0,0 +1,27 @@
From c1832eabb99cec47f1714f696275285e1e28da34 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Tue, 2 Apr 2019 16:20:50 +0200
Subject: [PATCH] Don't resolve symlinks when trying to find INSTALL_PATH
Nix specific patch. This behavior breaks roundcube setups where plugins
are in a store path with symlinks to the actual source.
---
bin/update.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/update.sh b/bin/update.sh
index 08e3bb5..b2ad498 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -19,7 +19,7 @@
+-----------------------------------------------------------------------+
*/
-define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
+define('INSTALL_PATH', __DIR__ . '/../' );
require_once INSTALL_PATH . 'program/include/clisetup.php';
--
2.19.2

View file

@ -1,14 +1,21 @@
{ lib, stdenv, fetchzip, buildEnv, roundcube, roundcubePlugins }:
let
{ lib, fetchurl, stdenv, buildEnv, roundcube, roundcubePlugins }:
stdenv.mkDerivation rec {
pname = "roundcube";
version = "1.3.8";
in
fetchzip rec {
name= "roundcube-${version}";
url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz";
sha256 = "1lhwr13bglm8rqgamnb480b07wpqhw9bskjj2xxb0x8kdjly29ks";
src = fetchurl {
url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/roundcubemail-${version}-complete.tar.gz";
sha256 = "018djad7ygfl9c9f2l2j42qkg31ml3hs2f01f0dk361zckwk77n4";
};
extraPostFetch = ''
patches = [ ./0001-Don-t-resolve-symlinks-when-trying-to-find-INSTALL_P.patch ];
dontBuild = true;
installPhase = ''
mkdir $out
cp -r * $out/
ln -sf /etc/roundcube/config.inc.php $out/config/config.inc.php
rm -rf $out/installer
'';