-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinit-container.sh
More file actions
executable file
·32 lines (26 loc) · 929 Bytes
/
init-container.sh
File metadata and controls
executable file
·32 lines (26 loc) · 929 Bytes
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
#!/usr/bin/env bash
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
THIS_SCRIPT_PATH="$(dirname "$THIS_SCRIPT")"
if [[ ! $1 =~ "debug" ]]; then
echo "---- Generating CDN ---"
rm -rf "$THIS_SCRIPT_PATH/../cdn/deploy"
cd "$THIS_SCRIPT_PATH/../cdn"
php -d include_path=/var/www/html/_includes:. cdnrefresh.php
cd ..
else
echo "Skip Generating CDN and clean CDN cache"
rm -rf "$THIS_SCRIPT_PATH/../cdn/deploy"
fi
# PHP localization strings need to have '$' escaped like '%1\$s'.
# But the download files from Crowdin get escaped again as '%1\\$s'.
# Reverts to escaping once.
cd "$THIS_SCRIPT_PATH/../_includes/locale/strings"
find . -type f -name "*.php" -print0 | while IFS= read -r -d '' file; do
# Not doing sed in-place to avoid permission errors
sed -r 's/([0-9])\\{2}\$/\1\\\$/g' "$file" > temp
if [ $? -ne 0 ]; then
echo "ERROR cleaning up files: $file"
exit 1
fi
mv temp "$file"
done