Description: Support zstd compression for file based chroots.
Author: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/988274
Last-Update: 2022-05-30

--- a/etc/setup.d/05file
+++ b/etc/setup.d/05file
@@ -38,6 +38,8 @@
         filetype="tzo"
     elif echo "$CHROOT_FILE" | egrep -q '(\.tar\.lz4|\.tlz4)$'; then
         filetype="tlz4"
+    elif echo "$CHROOT_FILE" | egrep -q '\.tar\.zstd$'; then
+        filetype="tzstd"
     else
         fatal "Unsupported filetype for $CHROOT_FILE"
     fi
@@ -62,6 +64,8 @@
         tar $TAR_VERBOSE --lzop -xf "$CHROOT_FILE"
     elif [ "$filetype" = "tlz4" ]; then
         lz4 -cd "$CHROOT_FILE" | tar $TAR_VERBOSE -x
+    elif [ "$filetype" = "tzstd" ]; then
+        zstd -cd "$CHROOT_FILE" | tar "$TAR_VERBOSE" -x
     else
         fatal "Unsupported filetype for $CHROOT_FILE"
     fi
@@ -86,6 +90,8 @@
         tar $TAR_VERBOSE --lzop -cf "$NEWFILE" .
     elif [ "$filetype" = "tlz4" ]; then
         tar $TAR_VERBOSE -c . | lz4 > "$NEWFILE"
+    elif [ "$filetype" = "tzstd" ]; then
+        tar "$TAR_VERBOSE" -c . | zstd > "$NEWFILE"
     else
         fatal "Unsupported filetype for $CHROOT_FILE"
     fi
