| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- #!/bin/bash
- # define colors for output
- NORMAL=$(tput sgr0)
- RED=$(tput setaf 1)
- GREEN=$(tput setaf 2)
- YELLOW=$(tput setaf 3)
- BLUE=$(tput setaf 4)
- UNDERLINE=$(tput smul)
- header ()
- {
- # clear screen
- clear
-
- printf "${UNDERLINE}Uninstall cloud sync via RCLONE\n"
- printf "\n"
- printf "${NORMAL}Please select the options you'd like to remove from this system.\n"
- printf "Please note that this script also allows you to ${RED}delete your saves${NORMAL}.\n"
- printf "\n"
- printf "To ${GREEN}keep your saves${NORMAL}, ${RED}do not remove ${NORMAL}the ${YELLOW}local base save directory${NORMAL}\n"
- printf "and the ${YELLOW}core overrides ${NORMAL}pointing to these directories!\n"
- printf "\n"
- }
- removeRCLONE ()
- {
- # remove RCLONE binary
- printf "${NORMAL} Removing RCLONE binary... "
-
- { #try
- retval=$(sudo rm /usr/bin/rclone 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- removeRCLONEconfiguration ()
- {
- # remove RCLONE configuration
- printf "${NORMAL} Removing RCLONE configuration... "
-
- { #try
- retval=$(rclone config delete retropie 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- removePNGVIEW ()
- {
- # remove PNGVIEW binary
- printf "${NORMAL} Removing PNGVIEW binary... "
-
- { #try
- retval=$(sudo rm /usr/bin/pngview 2>&1) &&
- retval=$(sudo rm /usr/lib/libraspidmx.so.1 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- removeIMAGEMAGICK ()
- {
- # remove IMAGEMAGICK
- printf "${NORMAL} Removing IMAGEMAGICK... "
-
- { #try
- retval=$(sudo apt-get --yes remove imagemagick* 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- removeRUNCOMMAND ()
- {
- # remove RUNCOMMAND scripts
- printf "${NORMAL} Removing RUNCOMMAND calls to RCLONE_SCRIPT... "
-
- { #try
- retval=$(sed -i "/^~\/scripts\/rclone_script.sh /d" /opt/retropie/configs/all/runcommand-onstart.sh 2>&1) &&
- retval=$(sed -i "/^~\/scripts\/rclone_script.sh /d" /opt/retropie/configs/all/runcommand-onend.sh 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- removeRCLONE_SCRIPT ()
- {
- # remove RCLONE_SCRIPT
- printf "${NORMAL} Removing RCLONE_SCRIPT... "
-
- { #try
- #don't acutally do this while it's being made
- retval=$(rm -d ~/scripts/rclone_script.sh 2>&1) &&
- retval=$(rm -d ~/scripts/rclone_script.ini 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- removeRCLONE_SCRIPT-FULLSYNC ()
- {
- # TODO
- }
- removeLocalSaveDirectory ()
- {
- # remove base save directory
- printf "${NORMAL} Removing local base save directory... "
-
- { #try
- retval=$(rm -r ~/RetroPie/saves 2>&1) &&
-
- printf "${GREEN}Done\n"
- } || { #catch
- printf "${RED}ERROR: ${retval}\n"
- }
- }
- # main program
- header
- read -p "${NORMAL}Remove RCLONE configuration? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removeRCLONEconfiguration
- fi
- read -p "${NORMAL}Remove RCLONE binary? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removeRCLONE
- fi
- read -p "${NORMAL}Remove PNGVIEW binary? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removePNGVIEW
- fi
- read -p "${NORMAL}Remove IMAGEMAGICK? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removeIMAGEMAGICK
- fi
- read -p "${NORMAL}Remove RUNCOMMAND calls to RCLONE_SCRIPT? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- printf " ${RED}ATTENTION!${NORMAL} By removing these calls your saves will no longer be\n"
- printf " synchronized. Your progress in games will be available on this machine only!\n"
-
- read -p " ${NORMAL}Really proceed? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removeRUNCOMMAND
- fi
- fi
- read -p "${NORMAL}Remove RCLONE_SCRIPT? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- printf " ${RED}ATTENTION!${NORMAL} By removing RCLONE_SCRIPT your saves will no longer be\n"
- printf " synchronized. Your progress in games will be available on this machine only!\n"
-
- read -p " ${NORMAL}Really proceed? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removeRCLONE_SCRIPT
- fi
- fi
- read -p "${NORMAL}Remove local base save directory? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- printf " ${RED}ATTENTION!${NORMAL} This directory contains your saves.\n"
- printf " By removing this directory you ${RED}WILL LOSE ${NORMAL}all saves!\n"
-
- read -p " ${NORMAL}Really proceed? ([y], n): " userInput
- userInput=${userInput:-y}
- if [ "${userInput}" = "y" ]; then
- removeLocalSaveDirectory
- fi
- fi
|