mirror of
https://github.com/GrapheneOS/matrix.grapheneos.org.git
synced 2024-12-30 09:56:20 -05:00
42 lines
805 B
Bash
Executable File
42 lines
805 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
shopt -s dotglob extglob globstar
|
|
|
|
if [[ $# -eq 1 ]]; then
|
|
fd=$1
|
|
else
|
|
touch lock
|
|
exec {fd}< lock
|
|
fi
|
|
|
|
if ! flock -n $fd; then
|
|
echo already processing/deploying static files >&2
|
|
exit 1
|
|
fi
|
|
|
|
export PATH="$PWD/node_modules/.bin:$PATH"
|
|
|
|
rm -rf nginx-tmp
|
|
cp -a nginx nginx-tmp
|
|
|
|
gixy nginx-tmp/nginx.conf
|
|
|
|
rm -rf static-tmp
|
|
cp -a /usr/share/webapps/element static-tmp
|
|
cp --remove-destination webapps/element/config.json static-tmp/config.json
|
|
|
|
brotli_k() {
|
|
brotli -k "$@"
|
|
}
|
|
export -f brotli_k
|
|
|
|
zopfli_preserve_time() {
|
|
zopfli "$1"
|
|
touch -r "$1" "$1.gz"
|
|
}
|
|
export -f zopfli_preserve_time
|
|
|
|
find static-tmp -regex '.+\.\(css\|html\|ico\|js\|json\|map\|svg\|txt\|wasm\|xml\)' |
|
|
parallel -q ::: brotli_k zopfli_preserve_time :::: -
|