mirror of
https://github.com/Nuzair46/SpotX-Linux.git
synced 2024-10-22 20:47:01 -06:00
Add uninstall
This commit is contained in:
parent
b0f7621112
commit
5b488f5db5
37
uninstall.sh
37
uninstall.sh
|
@ -7,38 +7,45 @@ while getopts 'P:' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
P)
|
P)
|
||||||
PATH_FLAG="${OPTARG}"
|
PATH_FLAG="${OPTARG}"
|
||||||
INSTALL_PATH="${PATH_FLAG}" ;;
|
INSTALL_PATH="${PATH_FLAG}"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: Flag not supported."
|
echo "Error: Flag not supported."
|
||||||
exit ;;
|
exit
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Locate install directory
|
# Locate install directory
|
||||||
if [ -z ${INSTALL_PATH+x} ]; then
|
if [ -z ${INSTALL_PATH+x} ]; then
|
||||||
INSTALL_PATH=$(readlink -e `type -p spotify` 2>/dev/null | rev | cut -d/ -f2- | rev)
|
INSTALL_PATH=$(readlink -e $(type -p spotify) 2> /dev/null | rev | cut -d/ -f2- | rev)
|
||||||
if [[ -d "${INSTALL_PATH}" && "${INSTALL_PATH}" != "/usr/bin" ]]; then
|
if [[ -d ${INSTALL_PATH} && ${INSTALL_PATH} != "/usr/bin" ]]; then
|
||||||
echo "Spotify directory found in PATH: ${INSTALL_PATH}"
|
echo "Spotify directory found in PATH: ${INSTALL_PATH}"
|
||||||
elif [[ ! -d "${INSTALL_PATH}" ]]; then
|
elif [[ ! -d ${INSTALL_PATH} ]]; then
|
||||||
echo -e "\nSpotify not found in PATH. Searching for Spotify directory..."
|
echo -e "\nSpotify not found in PATH. Searching for Spotify directory..."
|
||||||
INSTALL_PATH=$(timeout 10 find / -type f -path "*/spotify*Apps/*" -name "xpui.spa" -size -7M -size +3M -print -quit 2> /dev/null | rev | cut -d/ -f3- | rev)
|
INSTALL_PATH=$(timeout 10 find / -type f -path "*/spotify*Apps/*" -name "xpui.spa" -size -7M -size +3M -print -quit 2> /dev/null | rev | cut -d/ -f3- | rev)
|
||||||
if [[ -d "${INSTALL_PATH}" ]]; then
|
if [[ -d ${INSTALL_PATH} ]]; then
|
||||||
echo "Spotify directory found: ${INSTALL_PATH}"
|
echo "Spotify directory found: ${INSTALL_PATH}"
|
||||||
elif [[ ! -d "${INSTALL_PATH}" ]]; then
|
elif [[ ! -d ${INSTALL_PATH} ]]; then
|
||||||
echo -e "Spotify directory not found. Set directory path with -P flag.\nExiting...\n"
|
echo -e "Spotify directory not found. Set directory path with -P flag.\nExiting...\n"
|
||||||
exit; fi
|
exit
|
||||||
elif [[ "${INSTALL_PATH}" == "/usr/bin" ]]; then
|
fi
|
||||||
|
elif [[ ${INSTALL_PATH} == "/usr/bin" ]]; then
|
||||||
echo -e "\nSpotify PATH is set to /usr/bin, searching for Spotify directory..."
|
echo -e "\nSpotify PATH is set to /usr/bin, searching for Spotify directory..."
|
||||||
INSTALL_PATH=$(timeout 10 find / -type f -path "*/spotify*Apps/*" -name "xpui.spa" -size -7M -size +3M -print -quit 2> /dev/null | rev | cut -d/ -f3- | rev)
|
INSTALL_PATH=$(timeout 10 find / -type f -path "*/spotify*Apps/*" -name "xpui.spa" -size -7M -size +3M -print -quit 2> /dev/null | rev | cut -d/ -f3- | rev)
|
||||||
if [[ -d "${INSTALL_PATH}" && "${INSTALL_PATH}" != "/usr/bin" ]]; then
|
if [[ -d ${INSTALL_PATH} && ${INSTALL_PATH} != "/usr/bin" ]]; then
|
||||||
echo "Spotify directory found: ${INSTALL_PATH}"
|
echo "Spotify directory found: ${INSTALL_PATH}"
|
||||||
elif [[ "${INSTALL_PATH}" == "/usr/bin" ]] || [[ ! -d "${INSTALL_PATH}" ]]; then
|
elif [[ ${INSTALL_PATH} == "/usr/bin" ]] || [[ ! -d ${INSTALL_PATH} ]]; then
|
||||||
echo -e "Spotify directory not found. Set directory path with -P flag.\nExiting...\n"
|
echo -e "Spotify directory not found. Set directory path with -P flag.\nExiting...\n"
|
||||||
exit; fi; fi
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if [[ ! -d "${INSTALL_PATH}" ]]; then
|
if [[ ! -d ${INSTALL_PATH} ]]; then
|
||||||
echo -e "Directory path set by -P was not found.\nExiting...\n"
|
echo -e "Directory path set by -P was not found.\nExiting...\n"
|
||||||
exit; fi; fi
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# XPUI paths
|
# XPUI paths
|
||||||
XPUI_PATH="${INSTALL_PATH}/Apps"
|
XPUI_PATH="${INSTALL_PATH}/Apps"
|
||||||
|
@ -46,7 +53,7 @@ XPUI_SPA="${XPUI_PATH}/xpui.spa"
|
||||||
XPUI_BAK="${XPUI_PATH}/xpui.bak"
|
XPUI_BAK="${XPUI_PATH}/xpui.bak"
|
||||||
|
|
||||||
# Check for backup file
|
# Check for backup file
|
||||||
if [[ ! -f "${XPUI_BAK}" ]]; then
|
if [[ ! -f ${XPUI_BAK} ]]; then
|
||||||
echo -e "Backup file not found.\nExiting...\n"
|
echo -e "Backup file not found.\nExiting...\n"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user