feat: Add automatic XIVLauncher installation to the installer script and update the README to reflect this new capability.
This commit is contained in:
parent
a9ba614537
commit
1ec9339b26
2 changed files with 122 additions and 4 deletions
116
installer.sh
116
installer.sh
|
|
@ -12,6 +12,122 @@ ICON_DIR="$HOME/.local/share/icons/hicolor/512x512/apps"
|
|||
echo "XIVLauncher Wrapper - Installer"
|
||||
echo "=========================================="
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Helper Functions
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
check_xivlauncher_installed() {
|
||||
# Check for Flatpak
|
||||
if command -v flatpak >/dev/null 2>&1; then
|
||||
if flatpak list --app | grep -q "dev.goats.xivlauncher"; then
|
||||
echo "Found XIVLauncher (Flatpak)."
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for Native
|
||||
if command -v xivlauncher >/dev/null 2>&1 || \
|
||||
command -v xivlauncher-core >/dev/null 2>&1 || \
|
||||
command -v xivlauncher-rb >/dev/null 2>&1; then
|
||||
echo "Found XIVLauncher (Native)."
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
install_flatpak_version() {
|
||||
echo "Attempting to install XIVLauncher via Flatpak..."
|
||||
if ! command -v flatpak >/dev/null 2>&1; then
|
||||
echo "Error: 'flatpak' command not found. Cannot install Flatpak version."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Ensure Flathub repo exists (common issue if not set up)
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
# Install
|
||||
flatpak install -y flathub dev.goats.xivlauncher
|
||||
}
|
||||
|
||||
install_aur_version() {
|
||||
local helper="$1"
|
||||
echo "Attempting to install XIVLauncher via AUR ($helper)..."
|
||||
|
||||
# Using xivlauncher-bin for faster installation
|
||||
$helper -S --noconfirm xivlauncher-bin
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Main Logic
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
echo "Checking for XIVLauncher installation..."
|
||||
|
||||
if ! check_xivlauncher_installed; then
|
||||
echo "XIVLauncher not found. Attempting auto-installation..."
|
||||
|
||||
if [ -f "/etc/os-release" ]; then
|
||||
. /etc/os-release
|
||||
fi
|
||||
|
||||
INSTALLED=false
|
||||
OS_ID="${ID:-linux}"
|
||||
OS_LIKE="${ID_LIKE:-}"
|
||||
|
||||
# Logic for SteamOS / Bazzite (Force Flatpak)
|
||||
# Bazzite often identifies as bazzite or fedora but has image-based constraints.
|
||||
# Usually recommended to use Flatpaks.
|
||||
if [[ "$OS_ID" == "steamos" ]] || [[ "$OS_ID" == "bazzite" ]] || [[ "$OS_ID" == "chimeraos" ]]; then
|
||||
echo "Detected Gaming OS ($OS_ID). Using Flatpak."
|
||||
install_flatpak_version
|
||||
if check_xivlauncher_installed; then INSTALLED=true; fi
|
||||
|
||||
# Logic for Arch / CachyOS (Try AUR, Fallback to Flatpak)
|
||||
elif [[ "$OS_ID" == "arch" ]] || [[ "$OS_ID" == "cachyos" ]] || [[ "$OS_LIKE" == *"arch"* ]]; then
|
||||
echo "Detected Arch-based OS ($OS_ID)."
|
||||
|
||||
if command -v yay >/dev/null 2>&1; then
|
||||
install_aur_version "yay"
|
||||
INSTALLED=true
|
||||
elif command -v paru >/dev/null 2>&1; then
|
||||
install_aur_version "paru"
|
||||
INSTALLED=true
|
||||
else
|
||||
echo "No AUR helper (yay/paru) found. Falling back to Flatpak."
|
||||
install_flatpak_version
|
||||
if check_xivlauncher_installed; then INSTALLED=true; fi
|
||||
fi
|
||||
|
||||
# Fallback for others
|
||||
else
|
||||
echo "Detected OS: $OS_ID."
|
||||
|
||||
if command -v flatpak >/dev/null 2>&1; then
|
||||
echo "Flatpak found. Defaulting to Flatpak version."
|
||||
install_flatpak_version
|
||||
if check_xivlauncher_installed; then INSTALLED=true; fi
|
||||
else
|
||||
echo "Flatpak is not installed."
|
||||
echo "We recommend installing XIVLauncher via Flatpak on this distribution."
|
||||
echo "Please install Flatpak using your package manager, then run this script again."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Final Check
|
||||
if ! check_xivlauncher_installed; then
|
||||
echo "WARNING: Automated installation failed or XIVLauncher is still not detected."
|
||||
echo "You will need to install XIVLauncher manually."
|
||||
read -p "Press Enter to continue with wrapper installation anyway..." _
|
||||
else
|
||||
echo "XIVLauncher installed successfully!"
|
||||
fi
|
||||
else
|
||||
echo "XIVLauncher is already present."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Create config directory if it doesn't exist
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue