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 "**************************"
echo echo
# Handle xpui.bak and FORCE_FLAG logic # xpui detection
if [[ "${FORCE_FLAG}" == "false" ]]; then if [[ ! -f "${XPUI_SPA}" ]]; then
if [[ -f "${XPUI_BAK}" ]]; then echo "xpui not found, skipping xpui patches..."
echo "SpotX backup found, SpotX has already been used on this install." XPUI_SKIP="true"
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 else
if [[ -f "${XPUI_BAK}" ]]; then if [[ "${FORCE_FLAG}" == "false" ]]; then
echo "Backup xpui found, restoring original..." if [[ -f "${XPUI_BAK}" ]]; then
rm "${XPUI_SPA}" echo "SpotX backup found, SpotX has already been used on this install."
cp "${XPUI_BAK}" "${XPUI_SPA}" echo -e "Re-run SpotX using the '-f' flag to force xpui patching.\n"
XPUI_SKIP="false" 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 else
echo "Creating xpui backup..." if [[ -f "${XPUI_BAK}" ]]; then
cp "${XPUI_SPA}" "${XPUI_BAK}" echo "Backup xpui found, restoring original..."
XPUI_SKIP="false"; fi; fi 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 # Extract xpui.spa
if [[ "${XPUI_SKIP}" == "false" ]]; then if [[ "${XPUI_SKIP}" == "false" ]]; then
@ -219,4 +223,4 @@ if [[ "${XPUI_SKIP}" == "false" ]]; then
(cd "${XPUI_DIR}"; zip -qq -r ../xpui.spa .) (cd "${XPUI_DIR}"; zip -qq -r ../xpui.spa .)
rm -rf "${XPUI_DIR}"; fi rm -rf "${XPUI_DIR}"; fi
echo -e "SpotX finished patching!\n" echo -e "SpotX finished patching!\n"