From d10ebc2d4149f552190842e15f02c1e07b9f0f1c Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Mon, 27 Jul 2026 19:59:40 +0500 Subject: [PATCH] erc: add DwarFS AppImage extraction support (eterbug #19242) Signed-off-by: Boris Yumankulov --- bin/erc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/erc b/bin/erc index 0534a32..7ce1010 100755 --- a/bin/erc +++ b/bin/erc @@ -155,10 +155,20 @@ extract_appimage() { local arc="$1" local subdir="$2" + local offset + + offset=$(LC_ALL=C grep -aboP 'DWARFS(?=[\x00-\x1f]{2})' "$arc" 2>/dev/null \ + | head -1 | cut -d: -f1) + if [ -n "$offset" ] ; then + is_command dwarfsextract \ + || fatal "dwarfsextract is required to extract DwarFS AppImage files" + mkdir -p "$subdir" || fatal "Could not create extraction directory $subdir" + docmd dwarfsextract -i "$arc" -o "$subdir" -O "$offset" + return + fi # Try unsquashfs with offset if is_command unsquashfs ; then - local offset chmod +x "$arc" 2>/dev/null offset="$("$arc" --appimage-offset 2>/dev/null)" # Fallback: find squashfs magic (for cross-arch AppImages)