2013-01-20 16:21:49 -08:00
|
|
|
#!/bin/bash
|
2013-04-14 05:05:22 -07:00
|
|
|
# Author : Ismael Barros² <ismael@barros2.org>
|
|
|
|
# License : BSD http://en.wikipedia.org/wiki/BSD_license
|
2013-01-20 16:21:49 -08:00
|
|
|
|
2013-04-01 15:05:29 -07:00
|
|
|
usage() { echo "$0 <image> <target>"; }
|
2013-01-20 16:21:49 -08:00
|
|
|
|
|
|
|
image="$1"
|
2013-03-26 08:14:00 -07:00
|
|
|
target="${2:-$(basename "$image" .run).AppDir}"
|
2013-03-12 02:54:32 -07:00
|
|
|
mountpoint="$(mktemp -d --suffix=_unpackAppImage)"
|
2013-01-20 16:21:49 -08:00
|
|
|
|
2013-04-01 15:05:29 -07:00
|
|
|
cleanup() { fusermount -u "$mountpoint"; }
|
|
|
|
|
2013-01-20 16:21:49 -08:00
|
|
|
[ -z "$image" ] && { usage; exit 1; }
|
|
|
|
[ -z "$target" ] && { usage; exit 1; }
|
|
|
|
|
2013-03-05 12:51:03 -08:00
|
|
|
echo "Unpacking \"${image}\" on \"${target}\"..."
|
|
|
|
|
2013-03-29 15:48:26 -07:00
|
|
|
mkdir -p "$target" || exit 1
|
2013-01-20 16:21:49 -08:00
|
|
|
|
2013-03-29 15:48:26 -07:00
|
|
|
fuseiso -p "$image" "$mountpoint" || exit 1
|
2013-04-01 15:05:29 -07:00
|
|
|
trap cleanup EXIT
|
|
|
|
|
2013-03-29 15:48:26 -07:00
|
|
|
cp -av "$mountpoint"/* "$target"/ || exit 1
|
2013-04-01 15:05:29 -07:00
|
|
|
cleanup
|