From 4dc84a2896c730d014edeff61c0cbd3d1e239266 Mon Sep 17 00:00:00 2001
From: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
Date: Wed, 2 Jul 2014 16:31:03 -0300
Subject: [PATCH] build_package.sh: Fix permissions before creating package

Signed-off-by: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
---
 bin/build_package.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/bin/build_package.sh b/bin/build_package.sh
index e13152b6..5d4449a1 100755
--- a/bin/build_package.sh
+++ b/bin/build_package.sh
@@ -20,6 +20,20 @@ function showHelp() {
 
 }
 
+# The DEBIAN dir and post/pre inst/rm files should have the right
+# permissions
+function fixPerms() {
+    local pkg=$1
+
+    controlDir="$REPOROOT/$pkg/package/DEBIAN"
+    chmod 0755 $controlDir
+    for file in preinst prerm postinst postrm; do
+        if [ -f "$controlDir/$file" ]; then
+            chmod 0775 "$controlDir/$file"
+        fi
+    done
+}
+
 # This function is used to keep all the packages with their AUTHORS and
 # COPYING files up to date.
 function copyDoc() {
@@ -97,6 +111,7 @@ function createPackage() {
 
     local ret=0
 
+    fixPerms $pkg
     fakeroot dpkg -b $REPOROOT/$pkg/package/ $PACKAGESDEST/
 
     return $?
-- 
GitLab