aboutsummaryrefslogtreecommitdiff
path: root/mail/postfix/patches/900_less_overlayfs_rewrites.patch
blob: 6e51f74dc6b640729e8c981095cb1833848c5817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff -Naur a/conf/post-install b/conf/post-install
--- a/conf/post-install	2015-12-28 00:00:45.000000000 +0000
+++ b/conf/post-install	2017-08-01 22:42:30.476896711 +0000
@@ -561,15 +561,16 @@
 	    then
 		set_permission=1
 	    fi
+	    test -n "$recursive" && nonrecursive="" || nonrecursive="-maxdepth 0"
 	    test -n "$set_permission" && {
-		chown $recursive $owner $path || exit 1
-		test -z "$group" || chgrp $recursive $group $path || exit 1
+		find $path $nonrecursive ! -user $owner -exec chown $owner "{}" ";" || exit 1
+		test -z "$group" || find $path $nonrecursive ! -group $group -exec chgrp $group "{}" ";" || exit 1
 		# Don't "chmod -R"; queue file status is encoded in mode bits.
 		if [ "$type" = "d" -a -n "$recursive" ]
 		then
-		    find $path -type d -exec chmod $mode "{}" ";"
+		    find $path -type d -a ! -perm $mode -exec chmod $mode "{}" ";"
 		else
-		    chmod $mode $path
+		    find $path $nonrecursive ! -perm $mode -exec chmod $mode "{}" ";"
 		fi || exit 1
 	    }
 	done