Additional Spotify Directory Detection (#13)

- add exclusions and additional conditions/searching when Spotify PATH set to /usr/bin
This commit is contained in:
jetfir3 2022-11-20 18:08:04 -05:00 committed by GitHub
parent 1e309cf468
commit 8240a1d884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,14 +37,22 @@ echo
# 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}" ]]; 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"
exit; fi
elif [[ "${INSTALL_PATH}" == "/usr/bin" ]]; then
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)
if [[ -d "${INSTALL_PATH}" && "${INSTALL_PATH}" != "/usr/bin" ]]; then
echo "Spotify directory found: ${INSTALL_PATH}"
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