[pve-devel] [PATCH manager v2 08/17] postinst: simplify root's mail .forward check

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Mar 12 14:13:59 CET 2018


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 debian/postinst | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index 0e49eb56..fca33bd5 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -58,13 +58,8 @@ EOF
 	pveam update || true
     fi
 
-    if test -f /root/.forward; then
-	if ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then 
-	    echo -e "|/usr/bin/pvemailforward\n$(cat /root/.forward)" >/root/.forward.tmp
-	    mv /root/.forward.tmp /root/.forward
-	fi
-    else
-	echo '|/usr/bin/pvemailforward' >/root/.forward
+    if ! test -f /root/.forward || ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then
+	echo '|/usr/bin/pvemailforward' >>/root/.forward
     fi
 
     if [ -f /etc/systemd/system/ceph.service ]; then
-- 
2.14.2





More information about the pve-devel mailing list