]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mkosi-obs: fix compression detection
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 25 Feb 2025 11:40:02 +0000 (11:40 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 26 Feb 2025 00:22:38 +0000 (00:22 +0000)
The recompress variable is not reset in the loop, so if
there is a compressed ddi and an uncompressed one, the
variable will be true for the second one. Reset it.

mkosi/resources/mkosi-obs/mkosi.build

index 7f6aa94dbc71d9594c16e71d78373687fe7640c7..447fef12c51ae9a500b2da8bb70a7e38ec73daa7 100755 (executable)
@@ -67,6 +67,8 @@ while read -r SIG; do
             unzstd "${DEST%efi}"raw*.zst
             rm -f "${DEST%efi}"raw*.zst
             recompress=1
+        else
+            recompress=0
         fi
 
         offset="$(systemd-repart --json=short "${DEST%efi}"raw* | jq -r '.[] | select(.type == "esp") | .offset')"
@@ -198,6 +200,8 @@ while read -r SIG; do
         recompress=1
         unzstd "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"raw*.zst
         rm -f "$OUTPUTDIR/$(basename "${SIG%roothash.sig}")"raw*.zst
+    else
+        recompress=0
     fi
 
     ARGS=(
@@ -245,10 +249,14 @@ mapfile -t AUTHVARS < <(find hashes/authvars -type f -name "*.auth")
 if (( ${#AUTHVARS[@]} > 0 )); then
     for ddi in "$OUTPUTDIR"/*.raw*; do
         test -f "$ddi" || continue
+
         if [[ $ddi == *.zst ]]; then
             unzstd "${ddi}"
             recompress=1
+        else
+            recompress=0
         fi
+
         offset="$(systemd-repart --json=short "${ddi%.zst}" | jq -r '.[] | select(.type == "esp") | .offset')"
         if [ -z "$offset" ] || [ "$offset" = "null" ]; then
             if [[ $ddi == *.zst ]]; then