#!/usr/bin/bash

echo "YOU ARE ABOUT TO DESTROY THE DATABASE AND RESET YOUR EXTERNAL CRYPTOBONE"
echo -n "DOU YOU REALLY WANT TO DO THIS ?  : "
read RES

if [[ x${RES}x = xyesx ]]; then
     userdel cryptobone
     rm -rf /usr/lib/cryptobone/ext/cryptobone
     rm -f /usr/lib/cryptobone/ext/masterkey
     rm -f /usr/lib/cryptobone/ext/masterkey.hash
     rm -f /usr/lib/cryptobone/ext/EXTERN.local.hash
     rm -f /usr/lib/cryptobone/ext/database
     rm -f /usr/lib/cryptobone/ext/database.back
     echo
     echo "Your EXTERNAL Crypto Bone is now destroyed."
     echo "New secrets will be created on the next boot."
     echo "Please make sure that you transfer these secrets to your main machine"
     echo "before the second boot, as they will be deleted then."
else
     echo "Please answer yes if your are sure."
fi 
