2021-07-06 13:53:00 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
shopt -s dotglob extglob globstar
|
|
|
|
|
2022-07-18 17:14:14 -04:00
|
|
|
source venv/bin/activate
|
|
|
|
|
2022-05-05 00:26:23 -04:00
|
|
|
if [[ $# -eq 1 ]]; then
|
|
|
|
fd=$1
|
|
|
|
else
|
|
|
|
touch lock
|
|
|
|
exec {fd}< lock
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! flock -n $fd; then
|
2022-05-08 05:44:06 -04:00
|
|
|
echo already processing/deploying static files >&2
|
2022-05-05 00:26:23 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-11-25 20:33:45 -05:00
|
|
|
rm -rf nginx-tmp
|
|
|
|
cp -a nginx nginx-tmp
|
|
|
|
|
2022-06-28 00:03:13 -04:00
|
|
|
gixy nginx-tmp/nginx.conf
|
|
|
|
|
2021-11-23 18:45:28 -05:00
|
|
|
rm -rf static-tmp
|
|
|
|
cp -a /usr/share/webapps/element static-tmp
|
|
|
|
cp --remove-destination webapps/element/config.json static-tmp/config.json
|
2021-07-06 13:53:00 -04:00
|
|
|
|
2021-11-23 18:28:10 -05:00
|
|
|
zopfli_preserve_time() {
|
|
|
|
zopfli "$1"
|
|
|
|
touch -r "$1" "$1.gz"
|
|
|
|
}
|
|
|
|
export -f zopfli_preserve_time
|
|
|
|
|
2021-11-23 20:06:54 -05:00
|
|
|
find static-tmp -regex '.+\.\(css\|html\|ico\|js\|json\|map\|svg\|txt\|wasm\|xml\)' |
|
2022-11-01 00:20:47 -04:00
|
|
|
parallel -q ::: brotli zopfli_preserve_time :::: -
|