From 974ce1e9e9b0273435679371eb2e4cb1528c0855 Mon Sep 17 00:00:00 2001
From: Matej Ferencevic <matej.ferencevic@memgraph.io>
Date: Thu, 2 Apr 2020 17:57:40 +0200
Subject: [PATCH] Fix Debian package installation

Summary: `chattr` must be after `chown`.

Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2748
---
 release/debian/postinst | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/release/debian/postinst b/release/debian/postinst
index e126af578..c1e48ac2c 100644
--- a/release/debian/postinst
+++ b/release/debian/postinst
@@ -34,13 +34,16 @@ case "$1" in
             if [ ! -d $i/telemetry ]; then
                 mkdir $i/telemetry || exit 1
             fi
-            # Make snapshots directory immutable (optional)
-            chattr +i -R $i/snapshots || true
         done
 
         # Change ownership of all examples
         chown -R memgraph:memgraph /usr/share/memgraph/examples || exit 1
 
+        # Make snapshots directory immutable (optional)
+        for i in /usr/share/memgraph/examples/*; do
+            chattr +i -R $i/snapshots || true
+        done
+
         # Generate SSL certificates
         if [ ! -d /etc/memgraph/ssl ]; then
             mkdir /etc/memgraph/ssl || exit 1