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
10
README.md
10
README.md
|
|
@ -4,6 +4,7 @@ This is a wrapper script for Linux that launches `xivlauncher-core` (Native or F
|
|||
|
||||
## Features
|
||||
|
||||
- **Auto-Installation**: Automatically downloads and installs XIVLauncher if it's missing (using Flatpak or AUR depending on your OS).
|
||||
- **Auto-Detection**: Automatically detects if you are using the native `xivlauncher-core` (Arch/AUR) or the Flatpak version.
|
||||
- **OTP Injection**: Generates TOTP codes and sends them to the launcher's internal server.
|
||||
- **URL Support**: Accepts standard Base32 secrets OR full `otpauth://` URLs (e.g. from QR codes).
|
||||
|
|
@ -11,7 +12,7 @@ This is a wrapper script for Linux that launches `xivlauncher-core` (Native or F
|
|||
|
||||
## Installation (Steam Deck / Linux Desktop)
|
||||
|
||||
The easiest way to install is using the provided installer script.
|
||||
The easiest way to install is using the provided installer script. This script will check if XIVLauncher is installed and install it for you if needed (via Flatpak on SteamOS/Bazzite, or AUR on Arch).
|
||||
|
||||
1. **Run the Installer:**
|
||||
```bash
|
||||
|
|
@ -21,9 +22,10 @@ The easiest way to install is using the provided installer script.
|
|||
When prompted, enter your **TOTP Secret** or paste a full **otpauth:// URL**.
|
||||
|
||||
**What it does:**
|
||||
* Creates `~/.config/xivlauncher-wrapper/config.json`.
|
||||
* Installs the wrapper to `~/.local/bin/xivlauncher-wrapper`.
|
||||
* Installs a `.desktop` file to `~/.local/share/applications/` so it appears in your application menu.
|
||||
* **Checks for XIVLauncher:** Installs it via Flatpak or AUR if not found.
|
||||
* **Creates Config:** Creates `~/.config/xivlauncher-wrapper/config.json`.
|
||||
* **Installs Wrapper:** Installs the wrapper to `~/.local/bin/xivlauncher-wrapper`.
|
||||
* **Installs Shortcut:** Installs a `.desktop` file to `~/.local/share/applications/` so it appears in your application menu.
|
||||
|
||||
### Steam Integration (Steam Deck)
|
||||
1. Switch to Desktop Mode.
|
||||
|
|
|
|||
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