Improve xpui detection

- checks for existence of `xpui.spa` before attempting any other xpui handling.
This commit is contained in:
jetfir3 2022-10-21 11:58:53 -04:00 committed by GitHub
parent ff866ebbe1
commit cda9aecfae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"
echo -e "SpotX finished patching!\n"