diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-01-05 13:21:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 13:21:12 +0100 |
commit | adef2b85c8c8f771d694dedec2c8509694aee149 (patch) | |
tree | e4d2601b70e036ede8397f71d75304813a5ebc31 | |
parent | 2171e37b7d6d3990beb37dce26d30ca29154e89f (diff) | |
parent | e035c659a51b97aae65a9909db9c110bed56afbd (diff) | |
download | nextcloud-server-adef2b85c8c8f771d694dedec2c8509694aee149.tar.gz nextcloud-server-adef2b85c8c8f771d694dedec2c8509694aee149.zip |
Merge pull request #36015 from nextcloud/techdebt/36014/fix-image-optimization
fix(CI): Check for the image-optimization binaries we want to use
-rwxr-xr-x | build/image-optimization.sh | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/build/image-optimization.sh b/build/image-optimization.sh index 6d494b8ddb7..e559d8552f6 100755 --- a/build/image-optimization.sh +++ b/build/image-optimization.sh @@ -1,5 +1,25 @@ #!/usr/bin/env bash +set -e + +OPTIPNG=$(which optipng) +if ! [ -x "$OPTIPNG" ]; then + echo "optipng executable not found, please install" >&2 + exit 1 +fi +JPEGOPTIM=$(which jpegoptim) +if ! [ -x "$JPEGOPTIM" ]; then + echo "jpegoptim executable not found, please install" >&2 + exit 2 +fi +SCOUR=$(which scour) +if ! [ -x "$SCOUR" ]; then + echo "scour executable not found, please install" >&2 + exit 3 +fi + +set +e + CHECK_DIR='../' if [[ -d "$1" ]]; then CHECK_DIR=$1 @@ -20,7 +40,7 @@ function recursive_optimize_images() { do [[ -e "$png" ]] || break - optipng -o6 -strip all "$png" + $OPTIPNG -o6 -strip all "$png" done # Optimize all JPGs @@ -28,7 +48,7 @@ function recursive_optimize_images() { do [[ -e "$jpg" ]] || break - jpegoptim --strip-all "$jpg" + $JPEGOPTIM --strip-all "$jpg" done # Optimize all SVGs @@ -37,7 +57,7 @@ function recursive_optimize_images() { [[ -e "$svg" ]] || break mv $svg $svg.opttmp - scour --create-groups \ + $SCOUR --create-groups \ --enable-id-stripping \ --enable-comment-stripping \ --shorten-ids \ |