299:f2a7a39d2417
Anton Shestakov <av6@dwimlabs.net>, Tue, 26 Jun 2018 18:17:41 +0800
contrib: add shortcut for providing --diff to ansible

previous change 282:72b0672a98f7

contrib/updatesri.sh

Permissions: -rwxr-xr-x

Other formats: Feeds:
#!/bin/bash
set -euo pipefail
( egrep -oh 'https://[^"]+\.js' "$@" || true ) | sort -u | while read -r url; do
hash=$(curl -fsS "$url" | openssl dgst -sha384 -binary | openssl base64 -A)
sed -i "\|$url| c\\ <script src=\"$url\" integrity=\"sha384-$hash\" crossorigin=\"anonymous\"></script>" "$@"
done
( egrep -oh 'https://[^"]+\.css' "$@" || true ) | sort -u | while read -r url; do
hash=$(curl -fsS "$url" | openssl dgst -sha384 -binary | openssl base64 -A)
sed -i "\|$url| c\\ <link rel=\"stylesheet\" href=\"$url\" integrity=\"sha384-$hash\" crossorigin=\"anonymous\">" "$@"
done