[TASK] Add script to check file permission for files 35/49335/7
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 2 Aug 2016 20:51:59 +0000 (22:51 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 3 Aug 2016 17:43:41 +0000 (19:43 +0200)
Resolves: #77367
Releases: master
Change-Id: Id2a8675d3d1a4be5a71b17ba80ed1843b34d67fa
Reviewed-on: https://review.typo3.org/49335
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Build/Scripts/checkFilePermissions.sh [new file with mode: 0755]

diff --git a/typo3/sysext/core/Build/Scripts/checkFilePermissions.sh b/typo3/sysext/core/Build/Scripts/checkFilePermissions.sh
new file mode 100755 (executable)
index 0000000..7ec6df3
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+#########################
+#
+# Check all files for their file permission.
+# An array of files to be excluded is in place.
+#
+# It expects to be run from the core root.
+#
+##########################
+
+# Array of files to ignore the file permission check
+IGNORE=()
+IGNORE[0]="typo3/cli_dispatch.phpsh"
+IGNORE[1]="typo3/sysext/core/Build/Configuration/TravisNginxFpm/ConfigureStartNginxFpm.sh"
+IGNORE[2]="typo3/sysext/core/Build/Scripts/cglFixMyCommit.sh"
+IGNORE[3]="typo3/sysext/core/Build/Scripts/checkFilePermissions.sh"
+IGNORE[4]="typo3/sysext/core/Build/Scripts/duplicateExceptionCodeCheck.sh"
+IGNORE[5]="typo3/sysext/core/Build/Scripts/splitFunctionalTests.sh"
+IGNORE[6]="typo3/sysext/core/Build/Scripts/xlfcheck.sh"
+IGNORE[7]="typo3/sysext/core/bin/typo3"
+
+COUNTER=0
+
+for FILE in $(find typo3/ -type f ! -perm 0644); do
+    if ! [[ ${IGNORE[*]} =~ "$FILE" ]]
+    then
+        echo $FILE
+        COUNTER=$((COUNTER+1))
+    fi
+done
+
+if [ ${COUNTER} -gt 0 ] ; then
+    echo "$COUNTER number of files have a wrong file permission set."
+    exit 1
+fi
+
+exit 0