From cda9aecfaeec8f4c911110b169764cb50a1887bb Mon Sep 17 00:00:00 2001 From: jetfir3 <95306468+jetfir3@users.noreply.github.com> Date: Fri, 21 Oct 2022 11:58:53 -0400 Subject: [PATCH] Improve xpui detection - checks for existence of `xpui.spa` before attempting any other xpui handling. --- install.sh | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/install.sh b/install.sh index fb84574..5318adc 100644 --- a/install.sh +++ b/install.sh @@ -96,27 +96,31 @@ echo "SpotX-Linux by @SpotX-CLI" echo "**************************" echo -# Handle xpui.bak and FORCE_FLAG logic -if [[ "${FORCE_FLAG}" == "false" ]]; then - if [[ -f "${XPUI_BAK}" ]]; then - echo "SpotX backup found, SpotX has already been used on this install." - echo -e "Re-run SpotX using the '-f' flag to force xpui patching.\n" - echo "Skipping xpui patches and continuing SpotX..." - XPUI_SKIP="true" - else - echo "Creating xpui backup..." - cp "${XPUI_SPA}" "${XPUI_BAK}" - XPUI_SKIP="false"; fi +# xpui detection +if [[ ! -f "${XPUI_SPA}" ]]; then + echo "xpui not found, skipping xpui patches..." + XPUI_SKIP="true" else - if [[ -f "${XPUI_BAK}" ]]; then - echo "Backup xpui found, restoring original..." - rm "${XPUI_SPA}" - cp "${XPUI_BAK}" "${XPUI_SPA}" - XPUI_SKIP="false" + if [[ "${FORCE_FLAG}" == "false" ]]; then + if [[ -f "${XPUI_BAK}" ]]; then + echo "SpotX backup found, SpotX has already been used on this install." + echo -e "Re-run SpotX using the '-f' flag to force xpui patching.\n" + echo "Skipping xpui patches and continuing SpotX..." + XPUI_SKIP="true" + else + echo "Creating xpui backup..." + cp "${XPUI_SPA}" "${XPUI_BAK}" + XPUI_SKIP="false"; fi else - echo "Creating xpui backup..." - cp "${XPUI_SPA}" "${XPUI_BAK}" - XPUI_SKIP="false"; fi; fi + if [[ -f "${XPUI_BAK}" ]]; then + echo "Backup xpui found, restoring original..." + rm "${XPUI_SPA}" + cp "${XPUI_BAK}" "${XPUI_SPA}" + XPUI_SKIP="false" + else + echo "Creating xpui backup..." + cp "${XPUI_SPA}" "${XPUI_BAK}" + XPUI_SKIP="false"; fi; fi; fi # Extract xpui.spa if [[ "${XPUI_SKIP}" == "false" ]]; then @@ -219,4 +223,4 @@ if [[ "${XPUI_SKIP}" == "false" ]]; then (cd "${XPUI_DIR}"; zip -qq -r ../xpui.spa .) rm -rf "${XPUI_DIR}"; fi -echo -e "SpotX finished patching!\n" \ No newline at end of file +echo -e "SpotX finished patching!\n"