#!/bin/bash ################################################################ # Colors # ################################################################ # Reset Off='\033[0m' # Text Reset # Regular Colors Red='\033[0;31m' # Red Green='\033[0;32m' # Green Yellow='\033[0;33m' # Yellow Purple='\033[0;35m' # Purple White='\033[0;37m' # White # Background On_Black='\033[40m' # Black OkBullet="${Green}${On_Black}:: ${White}${On_Black}" WarnBullet="${Yellow}${On_Black}:: ${White}${On_Black}" ErrBullet="${Red}${On_Black}:: ${White}${On_Black}" Ok="${Green}${On_Black} ok.${Off}" Fail="${Red}${On_Black} failed!${Off}" Nok="${Yellow}${On_Black} nok.${Off}" ################################################################ # Vars # ################################################################ XMRSH_DIR="/opt/xmr.sh" XMRSH_LOG_FILE="/tmp/xmr.sh-$(date +%Y%m%d-%H%M%S).log" ################################################################ # Functions # ################################################################ check_return() { if [ "$1" -ne 0 ]; then echo -e "${Fail}" echo -e "${ErrBullet}Installation failed. Check the logs in ${XMRSH_LOG_FILE}${Off}" exit "$1" fi } uninstall() { pushd $XMRSH_DIR || check_return $? echo -e "${OkBullet}Uninstalling xmr.sh..." docker-compose down >>"${XMRSH_LOG_FILE}" 2>&1 check_return $? while true; do read -r -e -p " Do you want to keep the data directory with the blockchain and other data files? [y/n]: " yn case $yn in [Yy]*) rm -rf !("data") check_return $? break ;; [Nn]*) popd || check_return $? rm -rf ./* check_return $? break ;; *) echo " Please answer yes or no." ;; esac done echo -e "${OkBullet}Uninstall complete." } exit 0