#!/bin/bash # Author : Ismael BarrosĀ² # License : BSD http://en.wikipedia.org/wiki/BSD_license usage() { echo "$0 "; } image="$1" target="${2:-$(basename "$image" .run).AppDir}" mountpoint="$(mktemp -d --suffix=_unpackAppImage)" cleanup() { fusermount -u "$mountpoint"; } [ -z "$image" ] && { usage; exit 1; } [ -z "$target" ] && { usage; exit 1; } echo "Unpacking \"${image}\" on \"${target}\"..." mkdir -p "$target" || exit 1 fuseiso -p "$image" "$mountpoint" || exit 1 trap cleanup EXIT cp -av "$mountpoint"/* "$target"/ || exit 1 cleanup