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
This commit is contained in:
Till Höppner 2018-09-19 18:42:13 +02:00 committed by xeji
parent 3410dcd90e
commit 5fb0ed64d0

View file

@ -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"