97 lines
2.8 KiB
Bash
Executable file
97 lines
2.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xivlauncher-wrapper"
|
|
CONFIG_FILE="$CONFIG_DIR/config.json"
|
|
LAUNCHER_CMD="flatpak run dev.goats.xivlauncher"
|
|
|
|
# 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 - Steam Deck 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)."
|
|
read -p "Enter your TOTP Secret: " 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" <<EOF
|
|
{
|
|
"secret": "$SECRET",
|
|
"launcher_cmd": "$LAUNCHER_CMD"
|
|
}
|
|
EOF
|
|
echo "Configuration created successfully at: $CONFIG_FILE"
|
|
echo "Launcher command set to: $LAUNCHER_CMD"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Installing application files..."
|
|
|
|
# Create directories
|
|
mkdir -p "$BIN_DIR"
|
|
mkdir -p "$APP_DIR"
|
|
mkdir -p "$ICON_DIR"
|
|
|
|
# Install Wrapper Script
|
|
echo "Installing wrapper script to $BIN_DIR/xivlauncher-wrapper..."
|
|
cp wrapper.py "$BIN_DIR/xivlauncher-wrapper"
|
|
chmod +x "$BIN_DIR/xivlauncher-wrapper"
|
|
|
|
# Install Icon
|
|
echo "Installing icon to $ICON_DIR/xivlauncher-wrapper.png..."
|
|
if [ -f "xivlauncher-wrapper.png" ]; then
|
|
cp xivlauncher-wrapper.png "$ICON_DIR/xivlauncher-wrapper.png"
|
|
else
|
|
echo "Warning: xivlauncher-wrapper.png not found in current directory. Icon installation skipped."
|
|
fi
|
|
|
|
# Install Desktop File
|
|
echo "Installing desktop file to $APP_DIR/xivlauncher-wrapper.desktop..."
|
|
# We generate the desktop file content to ensure paths are correct
|
|
cat > "$APP_DIR/xivlauncher-wrapper.desktop" <<EOF
|
|
[Desktop Entry]
|
|
Name=XIVLauncher Wrapper
|
|
Comment=FFXIV Launcher with OTP Injection
|
|
Exec=$BIN_DIR/xivlauncher-wrapper
|
|
Icon=xivlauncher-wrapper
|
|
Terminal=false
|
|
Type=Application
|
|
Categories=Game;
|
|
Keywords=ffxiv;launcher;mmo;
|
|
EOF
|
|
|
|
echo "Updating desktop database..."
|
|
if command -v update-desktop-database >/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."
|
|
|