#!/bin/bash
#
# BerryNet uninstallation script.
#
# Note: We are working on debianize BerryNet and its dependencies.
#       Both installation/uninstallation will become more easier and
#       cleaner.

rm_targets=(
    "/usr/local/berrynet/"
    "/usr/local/bin/berrynet-manager"
    "/etc/systemd/system/agent.service"
    "/etc/systemd/system/broker.service"
    "/etc/systemd/system/camera.service"
    "/etc/systemd/system/classify_movidius_server.service"
    "/etc/systemd/system/dashboard.service"
    "/etc/systemd/system/data_collector.service"
    "/etc/systemd/system/detection_fast_server.service"
    "/etc/systemd/system/detection_server.service"
    "/etc/systemd/system/journal.service"
    "/etc/systemd/system/line.service"
    "/etc/systemd/system/localimg.service"
    "/etc/apt/sources.list.d/berrynet.list"
    "/etc/modules-load.d/bcm2835-v4l2.conf"
)

echo -n "Uninstalling BerryNet..."
for target in ${rm_targets[@]}; do
    sudo rm -rf $target
done
sudo systemctl daemon-reload > /dev/null
echo -e " done\n"
echo "Please share your suggestions with us, and thank you for trying BerryNet:"
echo -e "\n\thttps://groups.google.com/a/dt42.io/d/forum/berrynet"
