#!/bin/bash -u [[ "$(id -u)" -ne 0 ]] && exec sudo "$0" "$@" binfmt_path=/proc/sys/fs/binfmt_misc [[ ! -e "$binfmt_path/register" ]] && mount -t binfmt_misc none "$binfmt_path" register() { echo "$@" > "$binfmt_path/register" 2>&1 | grep -v "Invalid argument" } register ':DOSWin:M::MZ::/usr/local/wine/bin/wine:' register ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' register ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' sudo -u "$SUDO_USER" xhost +local: || echo "You might need to run 'xhost +local:' from outside the chroot." cd "$(dirname "$0")" mkdir -p /usr/gnemul /usr/local/bin /usr/local/lib gnemul=/usr/gnemul/qemu-i386 rm -f /usr/local/wine "$gnemul" ln -fs "$(pwd)" "$gnemul" ln -fs "$gnemul/usr/local/wine" /usr/local/wine ln -fs "$gnemul/bin/qemu-i386" /usr/local/bin/ ln -fis "$gnemul"/usr/local/lib/{libGL.so.1,libglhost.so} /usr/local/lib/ echo echo "Ready to use." echo "Remember to run prep.sh each reboot." echo "Put /usr/local/wine/bin in your PATH." echo