#!/bin/bash

sudo rm -r /opt/share/shule
sudo rm /opt/bin/shule
if [ -z "$(ls -A /opt/share)" ]; then
   sudo rm -r /opt/share
else
   echo "/opt/share has other items in it. Therefore, the uninstaller will not delete it."
fi
if [ -z "$(ls -A /opt/bin)" ]; then
   sudo rm -r /opt/bin
else
   echo "/opt/bin has other items in it. Therefore, the uninstaller will not delete it."
fi
sudo rm -r /opt/shule
echo "Removing /opt/shule"
sudo rm /usr/share/polkit-1/actions/org.freedesktop.policykit.shule.policy
echo "Removing /usr/share/polkit-1/actions/org.freedesktop.policykit.shule.policy"
sudo rm /usr/share/polkit-1/actions/org.freedesktop.python3.policy
echo "Removing /usr/share/polkit-1/actions/org.freedesktop.python3.policy"
sudo rm /usr/share/applications/Shule.desktop
echo "Removing /usr/share/applications/Shule.desktop"
for d in /home/*; do
    sudo rm -r "$d/.local/share/Shule/" 2> /dev/null
    echo "If it exists, removing "$d"/.local/share/Shule"
done
sudo update-alternatives --remove-all shule
echo "MIME types not changed. You’ll have to change those back to normal manually until this uninstaller is updated."
