Commit | Line | Data |
---|---|---|
ed9f705c SL |
1 | #!/bin/bash |
2 | ||
3 | ## Cleanup the vendor tree. The main issue here is that civi Civi is | |
4 | ## deployed as a module inside a CMS, so all its source-code gets published. | |
5 | ## Some libraries distribute admin tools and sample files which should not | |
6 | ## be published. | |
7 | ## | |
8 | ## This script should be idempotent -- if you rerun it several times, it | |
9 | ## should always produce the same post-condition. | |
10 | ||
11 | ############################################################################## | |
12 | ## usage: safe_delete <relpath...> | |
13 | function safe_delete() { | |
14 | for file in "$@" ; do | |
15 | if [ -z "$file" ]; then | |
16 | echo "Skip: empty file name" | |
17 | elif [ -e "$file" ]; then | |
18 | rm -rf "$file" | |
19 | fi | |
20 | done | |
21 | } | |
22 | ||
23 | ############################################################################## | |
24 | ## Remove example/CLI scripts. They're not needed and increase the attack-surface. | |
70976812 | 25 | safe_delete vendor/phpoffice/phpword/samples |