From 5fb0ed64d0dfcb68d1e60e8a220f68ecc22c3967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20H=C3=B6ppner?= Date: Wed, 19 Sep 2018 18:42:13 +0200 Subject: [PATCH] appimage-run: Support type-1 Appimages (#45973) This attempts to detect older appimages and extract them in the same manner as new ones, without changing filesystem paths --- .../tools/package-management/appimage-run/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/package-management/appimage-run/default.nix b/pkgs/tools/package-management/appimage-run/default.nix index a7fb8da99669..8e236aa426fd 100644 --- a/pkgs/tools/package-management/appimage-run/default.nix +++ b/pkgs/tools/package-management/appimage-run/default.nix @@ -1,4 +1,4 @@ -{ stdenv, writeScript, buildFHSUserEnv, coreutils +{ stdenv, writeScript, buildFHSUserEnv, coreutils, file, libarchive , extraPkgs ? pkgs: [] }: buildFHSUserEnv { @@ -131,7 +131,14 @@ buildFHSUserEnv { export APPDIR="$SQUASHFS_ROOT/squashfs-root" if [ ! -x "$APPDIR" ]; then cd "$SQUASHFS_ROOT" - "$APPIMAGE" --appimage-extract 2>/dev/null + + if ${file}/bin/file --mime-type --brief --keep-going "$APPIMAGE" | grep -q iso; then + # is type-1 appimage + ${libarchive}/bin/bsdtar -x -C "$SQUASHFS_ROOT" -f "$APPIMAGE" + else + # is type-2 appimage + "$APPIMAGE" --appimage-extract 2>/dev/null + fi fi cd "$APPDIR"