-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
82 lines (57 loc) · 2.1 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
set -e
echo " ************** MODIFIED FILES"
printf ${MODIFIED_FILES}
printf "\n*****************************\n"
PATHS=$(printf ${MODIFIED_FILES} | tr \\n '\n')
while read -r local_file && [ ! -z "$local_file" ];
do
if [[ ! -f $local_file ]]
then
# skip the local file when it doesn't exist
continue
fi
#all local files must be found in changed files
if ! grep "^$local_file\$" <<< "$PATHS" >/dev/null; then
echo "Not found changes in local file '$local_file' when core file changed." >&2
exit 102
fi
done < <(grep -P '^app/code/core/.' <<< "$PATHS" | sed --expression='s/^app\/code\/core/app\/code\/local/g')
while read -r core_file && [ ! -z "$core_file" ];
do
local_file= $core_file | sed --expression='s/^app\/code\/core/app\/code\/local/g'
if [[ ! -f $local_file ]]
then
# skip deleted local files
continue
fi
#all core files must be found in changed files
if ! grep "^$core_file\$" <<< "$PATHS" >/dev/null; then
echo "Not found changes in core file '$core_file' when local file changed." >&2
exit 102
fi
done < <(grep -P '^app/code/local/Mage/.' <<< "$PATHS" | sed --expression='s/^app\/code\/local/app\/code\/core/g')
echo "$PATHS" | while read PATH ; do
#if [[ ${PATH} =~ ^(lib\/phpseclib|lib\/Zend|lib/PEAR)\/.+$ ]] ; then
# echo "Holy code changed: ${PATH}"
# exit 101
#fi
if [[ ! -f $PATH ]]
then
# skip deleted files
continue
fi
if [[ ${PATH} =~ ^app\/code\/local\/Varien\/(.+)$ ]] ; then
echo "Holy code changed: ${PATH}"
#exit 101
fi
done
# prevent overrides in community directory
community_overrides=$(grep -P '^app/code/community/.' <<< "$PATHS" | sed --expression='s/^app\/code\/community/app\/code\/core/g')
echo "$community_overrides" | while read CORE_FILE ; do
if [[ -f $CORE_FILE ]]
then
echo "Found overrides in 'app/code/community/'! If you need override core file, you must use local scope, not community. The file is: $CORE_FILE"
exit 103
fi
done