post: dbus: rename conf file and exit MIC build if policy check failed 53/198253/4 accepted/tizen/unified/20190307.231014 submit/tizen/20190305.041632
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Wed, 23 Jan 2019 02:30:48 +0000 (11:30 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Mon, 4 Mar 2019 07:02:21 +0000 (16:02 +0900)
Change-Id: Ibe4920d4ffc1d2cae289ff182ec49ef452a33b42
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
scripts/generic-dbus-policychecker.post

index c42a55f..3541260 100644 (file)
@@ -1,9 +1,23 @@
 #!/bin/sh
 echo "#################### generic-dbus-policychecker.post ####################"
 if [ -x /usr/bin/dbus-policychecker ] ; then
+       fail_cnt=0
        for f in /etc/dbus-1/system.d/*.conf; do
                echo
                echo "$0: Checking D-Bus policy file: $f"
-               /usr/bin/dbus-policychecker "$f"
+               result=$(/usr/bin/dbus-policychecker "$f")
+               fail=$(echo "$result" | grep FAILED | wc -l)
+               echo "$result"
+               if [ $fail -gt 0 ]; then
+                       echo "Found $fail Fails"
+                       echo "Remove conf file : mv $f $f.fail"
+                       mv "$f" "${f}.fail"
+                       fail_cnt=$(( ${fail_cnt} + 1 ))
+               fi
        done
+       if [ $fail_cnt -gt 0 ]; then
+               echo "Error: MIC build exits due to failed cases on dbus policy checker.(${fail_cnt} errors)"
+               exit 1
+       fi
+
 fi