about summary refs log tree commit diff
path: root/pkgs/servers/mail/postfix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2016-01-22 17:25:07 +0100
committerPeter Simons <simons@cryp.to>2016-01-22 17:25:07 +0100
commite6d42dfe04e289373d1ef6169d37c8c5ec6c55c6 (patch)
tree17974bc603b2be40b6163f47cc06b4ca58d234ec /pkgs/servers/mail/postfix
parentb076c780051587a8940c0fab9f083eef260a700d (diff)
parent39bd9be5a9dc8d8efe6016e3234302ab027dc4cf (diff)
downloadnixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.tar
nixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.tar.gz
nixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.tar.bz2
nixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.tar.lz
nixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.tar.xz
nixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.tar.zst
nixlib-e6d42dfe04e289373d1ef6169d37c8c5ec6c55c6.zip
Merge pull request #12459 from avnik/fix-var-lib-postfix-permissions
Make /var/lib/postfix world-readable
Diffstat (limited to 'pkgs/servers/mail/postfix')
-rw-r--r--pkgs/servers/mail/postfix/3.0.nix6
-rw-r--r--pkgs/servers/mail/postfix/post-install-script.patch28
2 files changed, 33 insertions, 1 deletions
diff --git a/pkgs/servers/mail/postfix/3.0.nix b/pkgs/servers/mail/postfix/3.0.nix
index 57c529ac0b65..9ea151e597bb 100644
--- a/pkgs/servers/mail/postfix/3.0.nix
+++ b/pkgs/servers/mail/postfix/3.0.nix
@@ -35,10 +35,14 @@ in stdenv.mkDerivation rec {
                 ++ lib.optional withMySQL libmysql
                 ++ lib.optional withSQLite sqlite;
 
-  patches = [ ./postfix-script-shell.patch ./postfix-3.0-no-warnings.patch ];
+  patches = [ ./postfix-script-shell.patch ./postfix-3.0-no-warnings.patch ./post-install-script.patch ];
 
   preBuild = ''
     sed -e '/^PATH=/d' -i postfix-install
+    sed -e "s|@PACKAGE@|$out|" -i conf/post-install
+
+    # post-install need skip permissions check/set on all symlinks following to /nix/store
+    sed -e "s|@NIX_STORE@|$NIX_STORE|" -i conf/post-install
 
     export command_directory=$out/sbin
     export config_directory=/etc/postfix
diff --git a/pkgs/servers/mail/postfix/post-install-script.patch b/pkgs/servers/mail/postfix/post-install-script.patch
new file mode 100644
index 000000000000..350fbf929b74
--- /dev/null
+++ b/pkgs/servers/mail/postfix/post-install-script.patch
@@ -0,0 +1,28 @@
+--- a/conf/post-install	1970-01-01 03:00:01.000000000 +0300
++++ b/conf/post-install	2016-01-20 13:25:18.382233172 +0200
+@@ -254,6 +254,8 @@
+ }
+ 
+ # Bootstrapping problem.
++meta_directory="@PACKAGE@/etc/postfix"
++command_directory="@PACKAGE@/bin"
+ 
+ if [ -n "$command_directory" ]
+ then
+@@ -528,7 +530,16 @@
+ 	    # Skip uninstalled files.
+ 	    case $path in
+ 	    no|no/*) continue;;
++        # Skip immutable files from package, correct permissions provided by Nix.
++        @PACKAGE@/*) continue;
+ 	    esac
++        # Also skip symlinks following to /nix/store
++        if test -L $path; then
++            case "$(readlink $path)" in
++                @NIX_STORE@/*) continue;
++            esac
++        fi
++
+ 	    # Pick up the flags.
+ 	    case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac
+ 	    case $flags in *c*) create_flag=1;; *) create_flag=;; esac