#!/bin/bash CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xivlauncher-wrapper" CONFIG_FILE="$CONFIG_DIR/config.json" # Install paths BIN_DIR="$HOME/.local/bin" APP_DIR="$HOME/.local/share/applications" ICON_DIR="$HOME/.local/share/icons/hicolor/512x512/apps" echo "XIVLauncher Wrapper - Installer" echo "==========================================" # Create config directory if it doesn't exist mkdir -p "$CONFIG_DIR" SETUP_CONFIG=true if [ -f "$CONFIG_FILE" ]; then echo "Configuration file already exists at: $CONFIG_FILE" read -p "Do you want to overwrite it? (y/N): " OVERWRITE if [[ ! "$OVERWRITE" =~ ^[Yy]$ ]]; then echo "Skipping configuration setup." SETUP_CONFIG=false fi fi if [ "$SETUP_CONFIG" = true ]; then echo "We will now set up the configuration file." echo "You will need your generic TOTP secret (base32 format) OR a full otpauth:// URL." read -p "Enter your TOTP Secret or URL: " SECRET if [ -z "$SECRET" ]; then echo "Error: Secret cannot be empty." # We can continue to install files even if config fails? # Or should we exit? Probably exit or just warn. # Let's exit for safety if they intended to set it up but failed. exit 1 fi cat > "$CONFIG_FILE" < "$APP_DIR/xivlauncher-wrapper.desktop" </dev/null 2>&1; then update-desktop-database "$APP_DIR" else echo "update-desktop-database not found, skipping." fi echo "" echo "Installation complete!" echo "You may need to add $BIN_DIR to your PATH if it's not already there."