#!/bin/bash
# Run this if you used 'simple-build-and-install' and you want to uninstall the program again.

set -e
cd "$( dirname "${BASH_SOURCE[0]}" )"

if [ x"$( whoami )" = x"root" ]; then
	echo "Error: don't run this script as root, this will mess up file permissions"
	exit 1
fi

cd build
echo "Uninstalling ..."
sudo make uninstall
cd ..

if [ x$( uname -m ) = x"x86_64" ]; then
	cd build32
	echo "Uninstalling 32-bit GLInject library ..."
	sudo make uninstall
	cd ..
fi

echo "Running post-install script ..."
sudo ./postinstall

echo "Done."
