#!/bin/sh # AskDavis Battlefield 2 on Linux. # curl -fsSL https://bf2.askdavis.com/linux.sh | sh # Installs Lutris if you have none, then runs our Lutris install script, which # sets up Wine and asks for the setup .exe you downloaded from https://bf2.askdavis.com/downloads. main() { set -eu YML_URL="https://bf2.askdavis.com/linux/askdavis-bf2.yml" DIR="${XDG_CACHE_HOME:-$HOME/.cache}/askdavis-bf2" YML="$DIR/askdavis-bf2.yml" if [ "$(id -u)" -eq 0 ]; then fail "Run this as your normal user, not as root (no sudo in front)." fi say "Getting the AskDavis install script" mkdir -p "$DIR" curl -fsSL "$YML_URL" -o "$YML" || fail "Could not download $YML_URL" if have lutris; then say "Lutris is installed" run_native elif have flatpak && flatpak info net.lutris.Lutris >/dev/null 2>&1; then say "Lutris (Flatpak) is installed" run_flatpak elif have pacman; then say "Installing Lutris with pacman (asks for your password)" sudo pacman -S --needed lutris /dev/null 2>&1; } say() { printf '\n==> %s\n' "$*"; } fail() { printf '\n!! %s\n' "$*" >&2; exit 1; } main "$@"