nixpkgs/pkgs/servers/mail/postfix/post-install-script.patch
Alexander V. Nikolaev 39bd9be5a9 postfix: use built-in set-permission tool to setup queue
Make top level /var/lib/postfix as root:root 0755

After generating custom configs in /var/lib/postfix/conf,
`postfix set-permissions` called, to perform all required tricks
related to queue handling (postfix use file mode bits to keep
some internal statuses, so `chmod -R` not recommended by authors,
see comments in $out/libexec/postfix/post-install for details)

Also post-install script was patched, to skip permission check/update
for files inside $out, as well as symlinks following to $NIX_STORE.

Config file `main.cf` extended with all default directory locations,
to prevent post-install script from guessing and overwrite them.

And finally all actions in activation script snippets performed
by postmap/postalias/postfix tools from current build, not random one
from paths.
2016-01-20 14:52:59 +02:00

29 lines
871 B
Diff

--- 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