2014-06-23 17:38:36 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This file is part of the phpBB Forum Software package.
|
|
|
|
#
|
|
|
|
# @copyright (c) phpBB Limited <https://www.phpbb.com>
|
|
|
|
# @license GNU General Public License, version 2 (GPL-2.0)
|
|
|
|
#
|
|
|
|
# For full copyright and license information, please see
|
|
|
|
# the docs/CREDITS.txt file.
|
|
|
|
#
|
|
|
|
set -e
|
2014-08-07 13:58:42 +02:00
|
|
|
|
2014-06-23 17:38:36 +02:00
|
|
|
DB=$1
|
|
|
|
TRAVIS_PHP_VERSION=$2
|
2015-09-28 17:40:24 +02:00
|
|
|
NOTESTS=$3
|
|
|
|
root="$4"
|
2014-08-07 13:58:42 +02:00
|
|
|
path="${root}phpBB/"
|
2014-06-23 17:38:36 +02:00
|
|
|
|
2015-09-28 17:40:24 +02:00
|
|
|
if [ "$NOTESTS" == '1' ]
|
2014-06-23 17:38:36 +02:00
|
|
|
then
|
2014-06-24 19:28:40 +02:00
|
|
|
# Check the permissions of the files
|
2014-06-23 17:38:36 +02:00
|
|
|
|
2014-06-24 21:07:14 +02:00
|
|
|
# The following variables MUST NOT contain any wildcard
|
2014-06-24 19:28:40 +02:00
|
|
|
# Directories to skip
|
|
|
|
directories_skipped="-path ${path}develop -o -path ${path}vendor"
|
|
|
|
|
|
|
|
# Files to skip
|
2014-07-31 00:34:17 +02:00
|
|
|
files_skipped="-false"
|
2014-06-24 19:28:40 +02:00
|
|
|
|
|
|
|
# Files which have to be executable
|
2015-11-10 16:57:25 +01:00
|
|
|
executable_files="-path ${path}bin/* -o -path ${path}install/phpbbcli.php"
|
2014-06-24 19:28:40 +02:00
|
|
|
|
2014-07-30 20:47:39 +02:00
|
|
|
incorrect_files=$( \
|
2014-06-23 17:38:36 +02:00
|
|
|
find ${path} \
|
|
|
|
'(' \
|
|
|
|
'(' \
|
2014-06-24 19:28:40 +02:00
|
|
|
${directories_skipped} \
|
2014-06-23 17:38:36 +02:00
|
|
|
')' \
|
|
|
|
-a -type d -prune -a -type f \
|
2014-06-24 19:28:40 +02:00
|
|
|
')' -o \
|
|
|
|
'(' \
|
|
|
|
-type f -a \
|
2014-06-23 17:38:36 +02:00
|
|
|
-not '(' \
|
2014-06-24 19:28:40 +02:00
|
|
|
${files_skipped} \
|
|
|
|
')' -a \
|
2014-06-23 23:26:08 +02:00
|
|
|
'(' \
|
2014-06-24 19:28:40 +02:00
|
|
|
'(' \
|
|
|
|
'(' \
|
|
|
|
${executable_files} \
|
|
|
|
')' -a \
|
2019-10-19 11:33:55 +02:00
|
|
|
-not -perm /100 \
|
2014-06-24 19:28:40 +02:00
|
|
|
')' -o \
|
|
|
|
'(' \
|
|
|
|
-not '(' \
|
|
|
|
${executable_files} \
|
|
|
|
')' -a \
|
2019-10-19 11:33:55 +02:00
|
|
|
-perm /111 \
|
2014-06-24 19:28:40 +02:00
|
|
|
')' \
|
|
|
|
')' \
|
2014-06-23 17:38:36 +02:00
|
|
|
')' \
|
2014-06-24 19:28:40 +02:00
|
|
|
)
|
2014-06-23 17:38:36 +02:00
|
|
|
|
2014-07-30 20:47:39 +02:00
|
|
|
if [ "${incorrect_files}" != '' ]
|
2014-06-23 17:38:36 +02:00
|
|
|
then
|
2014-08-07 13:58:42 +02:00
|
|
|
echo "The following files do not have proper permissions:";
|
2014-07-30 20:47:39 +02:00
|
|
|
ls -la ${incorrect_files}
|
2014-06-23 18:45:20 +02:00
|
|
|
exit 1;
|
2014-06-23 17:38:36 +02:00
|
|
|
fi
|
2014-06-23 18:45:20 +02:00
|
|
|
fi
|