#!/bin/bash
file="$1"
shift 1
dirname=$(md5sum "$file" | cut -f1 -d" ")
tmp="$HOME/.cache/appimage-loader/$dirname"
mkdir -p $tmp
cp "$file" "$tmp/appimage"
chmod 755 "$tmp/appimage"
"$tmp/appimage" "$@"
status="$?"
rm -rf "$tmp"
exit $status
