#!/bin/bash -efu
# SPDX-License-Identifier: GPL-3.0-or-later

. guess-functions

if [ ! -f "$imagefile" ]; then
	guess_feature compress
	exit 0
fi

init="$(initrd-ls -nC "$imagefile" |grep ' \./init$' |tail -1)"

for method in gzip bzip2 xz lzma lzo lz4 zstd; do
	if [ -z "${init##* $method *}" ]; then
		guess_feature compress
		break
	fi
done
