Restore file permissions from backup if possible
PROD-32436
Change-Id: I522b17eeb9a43cbc82127a2a7e61dfb06257fc14
diff --git a/maas/files/restore.sh b/maas/files/restore.sh
index b263a29..8f90301 100644
--- a/maas/files/restore.sh
+++ b/maas/files/restore.sh
@@ -31,6 +31,11 @@
pg_restore {{ target }}{{ db_name }}.pg_dump --dbname={{ db_name }} --no-password -c
+# Restore file permissions
+if [ $(which setfacl) != "" ] && [ -e /var/lib/maas/file_permissions.txt ]; then
+ setfacl --restore=/var/lib/maas/file_permissions.txt
+fi
+
mkdir -p /root/maas/flags
touch /root/maas/flags/{{ db_name }}-installed