#!/bin/bash

# Script to remove Backblaze Restore App
# Copyright (c) 2009-2024 Backblaze Inc. All rights reserved.
# Version 1.0
#

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

if [ $EUID -ne 0 ]; then
    echo "Requres to be run as root"
    exit 1
fi

## Removing the backblaze restore application
/usr/bin/killall -9 -q BackblazeRestore
/bin/rm -rf /Applications/BackblazeRestore.app

## Removing BackblazeRestore in Application Support
/bin/rm -fr $HOME/Library/Application\ Support/BackblazeRestore

## Removing backblaze restore logs
/bin/rm -fr $HOME/Library/Logs/BackblazeRestore

## Removing the app preferences
/bin/rm -f $HOME/Library/Preferences/com.backblaze.BackblazeRestore.plist

## Removing cache
/bin/rm -fr $HOME/Library/Caches/com.backblaze.BackblazeRestore

/bin/echo "Backblaze Restore application has been removed."

exit 0
