#!/bin/sh
# Un-install script for package, bu

if [ -f ~/.burc ]; then . ~/.burc; fi
  
version="$(ident bu | awk '/Id/ {print $3}')"
LOGDIR=${LOGDIR:-/var/backups/bu}
docdir=/usr/local/share/doc/bu-$version

cat << eof

A Normal un-install will delete bu, and it's doc files.  It does not
remove any backup logs or it's configuration files.

A Clean un-install will remove all traces of bu including the bu log
directory and roots ~/.burc file.  It will leave any .burc files in
other users home directores.

eof

read -p "(C)lean un-install or (N)ormal un-install? [N]> " reply

echo

case $reply in
  c* | C*)
    echo -e "\nClean un-install.  Removing all traces of bu."
    rm -f ~/.burc
    rm -rf $LOGDIR
    ;;
esac

rm -rf /usr/local/bin/bu $doc || exit
echo -e "Done.\nbu is no longer installed.\n"

