Skip to content

Instantly share code, notes, and snippets.

@Hello71
Last active December 5, 2015 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hello71/b84f3c4138b8ef68ad55 to your computer and use it in GitHub Desktop.
Save Hello71/b84f3c4138b8ef68ad55 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Run this script at boot somehow then run .exes directly.
# Requires "file" utility at least version 4.18 (released 2006-10-31)
# Uncomment the following line and adjust as necessary if necessary.
# iam="$HOME/bin/exe"
if [ "$#" = 0 ]; then
if ! [ -f "$iam" ]; then
iam="${BASH_SOURCE}"
if ! [ -f "$iam" ]; then
iam="$(readlink "$0")"
if ! [ -f "$iam" ]; then
iam="/usr/local/bin/exe"
if ! [ -f "$iam" ]; then
echo "fatal: could not determine script location." >&2
echo "install \"exe.sh\" as $iam or modify \$iam in the script." >&2
exit 1
fi
fi
fi
fi
printf ':EXE:M::MZ::%s:\n' "$iam" > /proc/sys/fs/binfmt_misc/register
else
case "$(file -b -e apptype -e ascii -e cdf -e compress -e elf -e encoding -e tar -e text -e tokens "$1")" in
*"Mono/.Net"*) exec mono "$@";;
*) exec wine "$@";;
esac
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment