Files
EAappInstall/install.sh

209 lines
7.1 KiB
Bash
Executable File

#!/usr/bin/env bash
echo "This script is insteded to help installing EA App on a generic linux envirment. Developed by Zacharias (c) Zacharias 2026"
if [[ $EUID -eq 0 ]] then
echo "You shuld not run this as root!"
echo "Exiting..."
exit 126
fi
if ! command -v steam > /dev/null 2>&1; then
echo "You need to install steam..."
exit 1
fi
## This variable contains ether the path of your GloriousEggroll Proton,
## or the magic number "PATH" to indicate that it can be executed without exact tergeting
## We will default to GE Proton, but support other protons if those are found instead.
PROTON_PATH=""
STEAM_CUTOM_PROTON_PATH="$HOME/.steam/steam/compatibilitytools.d"
GET_PROTON=0
TMP_DIR="/tmp/ea-app-installer"
rm -fr "$TMP_DIR"
mkdir "$TMP_DIR"
## Testing if proton ge is in path
if command -v proton-ge > /dev/null 2>&1; then
PROTON_PATH="PATH"
elif [[ -d "$STEAM_CUTOM_PROTON_PATH" ]] then
found=0
## We have found a known path for protons!
for subdir in "$STEAM_CUTOM_PROTON_PATH"/*/; do
subdir="${subdir%/}"
if [[ -x "$subdir/proton" ]] then
## We found a proton! we will asume this is a good and working one :)
PROTON_PATH="$subdir"
found=1
break
fi
done
if [[ $found -eq 0 ]] then
GET_PROTON=1
fi
else
GET_PROTON=1
fi
if [[ $GET_PROTON -eq 1 ]] then
echo "Failed to find Proton. If you know where Proton is, enter the path. Otherwise, we can install the latest Proton GE. Proceed? [Y/n]"
read answer
if [[ "$answer" == "y" || "$answer" == "yes" || "$answer" == "Y" || "$answer" == "" ]] then
echo "Installing Proton GE..."
GOOD_DIRECTORY=0
mkdir -p "$STEAM_CUTOM_PROTON_PATH"
if [[ -d "$STEAM_CUTOM_PROTON_PATH" ]] then
GOOD_DIRECTORY=1;
else
echo "Failed to create steam compatibilitytools directory (Proton directory). Please create it yourself and retry. Do not re run this as root!"
exit 1
fi
## Testing if the envirment is good and has the necisary commands, this will asume a GNU/Linux compadible envirment.
echo "Testing envirment..."
GOOD_ENV=1
MISSING_ENV=""
for cmd in curl grep cut sha512sum tar basename; do
if ! command -v "$cmd" >/dev/null 2>&1; then
GOOD_ENV=0
MISSING_ENV+="$cmd;"
fi
done
if [[ $GOOD_ENV -eq 0 ]] then
echo "You are missing vital commands in this environment. Please install: ${MISSING_ENV//;/ }"
exit 1
fi
echo "Envirment passes"
echo "Fetching tarball URL..."
tarball_url=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep browser_download_url | cut -d\" -f4 | grep .tar.gz)
tarball_name=$(basename $tarball_url)
echo "Downloading tarball $tarball_name..."
curl -sS -L "$tarball_url" -o "$TMP_DIR/$tarball_name" || {
echo "Download failed!"
exit 1
}
echo "Fetching checksum URL..."
checksum_url=$(curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest | grep browser_download_url | cut -d\" -f4 | grep .sha512sum)
checksum_name=$(basename $checksum_url)
echo "Downloading checksum: $checksum_name..."
curl -sS -L "$checksum_url" -o "$TMP_DIR/$checksum_name" || {
echo "Download failed!"
exit 1
}
echo "Verifying tarball $tarball_name with checksum $checksum_name..."
work_dir="$(pwd)"
cd "$TMP_DIR" || exit 1
if ! sha512sum -c "$checksum_name" > /dev/null 2>&1; then
echo "sha512 check failed. We discurage continuing with this, but we trust you [y/N]: "
read answer
if [[ "$answer" == "y" || "$answer" == "yes" || "$answer" == "Y" || "$answer" == "" ]] then
echo "This will not proceed at your own risk..."
else
echo "Exiting due to failed sha512 check"
exit 1
fi
fi
echo "Extracting $tarball_name to the Steam compatibility tools folder..."
tar -xf $tarball_name -C $STEAM_CUTOM_PROTON_PATH
echo "Done"
PROTON_PATH="$STEAM_CUTOM_PROTON_PATH/${tarball_name%.tar.gz}"
echo "Verifying existence of Proton"
if [[ -x "$PROTON_PATH/proton" ]] then
echo "Newly downloaded Proton exists"
else
echo "The newly downloaded Proton failed"
exit 1
fi
cd "$work_dir"
elif [[ "$answer" == "n" || "$answer" == "no" || "$answer" == "N" ]] then
echo "Please install proton thru other means."
exit 1
else
echo "Verifying existence of Proton"
if [[ -x "$answer/proton" ]] then
echo "Provided Proton exists"
PROTON_PATH="$answer"
else
echo "Failed to verify the provided Proton"
exit 1
fi
fi
fi
echo "Found Proton"
sleep 2
if [[ -z "$PROTON_PATH" ]] then
echo "The Proton Path is empty for unkown reasons. Please try again."
exit 1
fi
echo "Downloading the EA App Installer"
sleep 1
if ! command -v curl > /dev/null 2>&1; then
echo "Missing curl. Please download it."
exit 1
fi
curl -sS -L "https://origin-a.akamaihd.net/EA-Desktop-Client-Download/installer-releases/EAappInstaller.exe" -o "$TMP_DIR/EAappInstaller.exe" || {
echo "Failed to download EAappInstaller.exe from EA website."
exit 1;
}
echo "Asumtions are being made about instalation locations. (This script asumes that proton ge is used). copying .desktop file!"
export STEAM_COMPAT_DATA_PATH="$HOME/.local/share/EAapp/"
export STEAM_COMPAT_CLIENT_INSTALL_PATH="$HOME/.local/share/Steam"
export DXVK_STATE_CACHE_PATH="$HOME/.cache/dxvk-cache-pool"
mkdir -p "$STEAM_COMPAT_DATA_PATH"
echo "Using $STEAM_COMPAT_DATA_PATH as proton prefix. This is where EA App will be installed to"
# TODO: Add the copying or generation of the .desktop file
echo "Creating .desktop entry!"
echo "[Desktop Entry]
Comment[en_US]=Electronic Arts App
Comment=Electronic Arts App
Exec=env 'STEAM_COMPAT_DATA_PATH=$STEAM_COMPAT_DATA_PATH' 'STEAM_COMPAT_CLIENT_INSTALL_PATH=$STEAM_COMPAT_CLIENT_INSTALL_PATH' 'DXVK_STATE_CACHE_PATH=$DXVK_STATE_CACHE_PATH' '$PROTON_PATH/proton' 'C:\\Program Files\\Electronic Arts\\EA Desktop\\EA Desktop\\EADesktop.exe'
GenericName[en_US]=EA App
GenericName=
Icon=/home/$USER/Documents/scripts/EAApp/EAapp.ico
MimeType=
Name[en_US]=EA App
Name=EA App
Path="$STEAM_COMPAT_DATA_PATH/"
StartupNotify=true
StartupWMClass=EADesktop.exe
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
Categories=Game
" > "~/.local/share/applications"
echo "Copying the desktop icon!"
cp "./EAapp.ico" "/home/$USER/Documents/scripts/EAApp/EAapp.ico"
sleep 1
echo "Starting proton in 5s, we might lose controll, if no application starts then we might have an issue, I trust you proton!..."
sleep 5
if [[ "$PROTON_PATH" == "PATH" ]] then
proton-ge "$TMP_DIR/EAappInstaller.exe"
else
"$PROTON_PATH/proton" run "$TMP_DIR/EAappInstaller.exe"
fi