From f2f8786deeb3f06f18b6dad6e66fcdb605c5bc4b Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Wed, 18 Sep 2024 19:54:17 +0300 Subject: [PATCH] zip_image.sh --- .drone.yml | 2 +- meta/files/zip_image.sh | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.drone.yml b/.drone.yml index cf23348e..24937e9d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -66,6 +66,6 @@ steps: # drone sign --save upagge/digital-garden --- kind: signature -hmac: 810c6ba459d462fb8a9d63720d0b95523036ecfe7e4dfe431529833b5757a41c +hmac: c9ff18295f1971e3f052359dfa8edf863932dd0f64446af39644c31253c9b189 ... diff --git a/meta/files/zip_image.sh b/meta/files/zip_image.sh index 47ab06f4..95ab50b7 100644 --- a/meta/files/zip_image.sh +++ b/meta/files/zip_image.sh @@ -1,4 +1,3 @@ - #!/bin/bash file=comp.flag @@ -7,25 +6,25 @@ if [ -f "$file" ]; then fi find ./images/ -type f -not -path "./images/comp/*" ! -name "*-no-comp.*" $option -iname "*.png" -exec sh -c ' - png_file="${1/\/images\//\/images\/comp\/}" + png_file="./images/comp/${1#*/images/}" png_dir="$(dirname "$png_file")" mkdir -p "$png_dir" - cp "$1" "${png_file}" - optipng -o7 "${png_file}" - advpng -z4 "${png_file}" - pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow "${png_file}" + cp "$1" "$png_file" + optipng -o7 "$png_file" + advpng -z4 "$png_file" + pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow "$png_file" ' _ {} \; find ./images/ -type f -not -path "./images/comp/*" ! -name "*-no-comp.*" $option -iregex '.*\.\(jpg\|jpeg\)' -exec sh -c ' - jpg_file="${1/\/images\//\/images\/comp\/}" + jpg_file="./images/comp/${1#*/images/}" jpg_dir="$(dirname "$jpg_file")" mkdir -p "$jpg_dir" - cp "$1" "${jpg_file}" - jpegoptim --all-progressive "${jpg_file}" + cp "$1" "$jpg_file" + jpegoptim --all-progressive "$jpg_file" ' _ {} \; find ./images/comp -type f -iregex '.*\.\(jpg\|jpeg\|png\)' -not -iregex '.*no-comp\.\(jpg\|jpeg\|png\)' $option -exec sh -c ' - webp_file="${1/\/images\/comp\//\/images\/webp\/}" + webp_file="./images/webp/${1#*/images/comp/}" webp_dir="$(dirname "$webp_file")" mkdir -p "$webp_dir" cwebp -mt -af -progress -m 6 -q 75 -pass 10 "$1" -o "${webp_file%.*}.webp"