EmuDeck/functions/installEmuBI.sh
Mitja Skuver e5755f71d6
binupdate improvements (#648)
* binupdate improvements

- new safeDownload() in helperFunctions
- introduced showProgress argument for emulator downloads
- modified binupdate.sh to use showProgress
- modified emulator/tools install functions to use safeDownload()/showProgress and return proper exit code (CemuNative, Cemu, mGBA, PCSX2-QT, Ryujinx, Vita3K, Xenia, Yuzu, ESDE, SRM)
- installEmuAI() and installEmuBI() are now using new safeDownload() and return proper exit code
- installEmuAI() and installEmuBI() can now write last version info (new arguments)
- yuzu launcher: Added ~/emudeck/yuzu.noupdate to skip yuzu update, zenity progress bar and zenity error dialog

* formatting/whitespaces only

* Fixed shell error (quotes)

---------

Co-authored-by: Livedeht <godsbane@gmail.com>
2023-03-05 23:45:34 -05:00

57 lines
1.8 KiB
Bash

#!/bin/bash
installEmuBI(){
local name="$1"
local url="$2"
local altName="$3"
local format="$4"
local showProgress="$5"
local lastVerFile="$6"
local latestVer="$7"
if [[ "$altName" == "" ]]; then
altName="$name"
fi
echo "$name"
echo "$url"
echo "$altName"
echo "$format"
echo "$showProgress"
echo "$lastVerFile"
echo "$latestVer"
#rm -f "$HOME/Applications/$altName.$format" # mv below will overwrite...
mkdir -p "$HOME/Applications"
#curl -L "$url" -o "$HOME/Applications/$altName.$format.temp" && mv "$HOME/Applications/$altName.$format.temp" "$HOME/Applications/$altName.$format"
if safeDownload "$name" "$url" "$HOME/Applications/$altName.$format" "$showProgress"; then
if [[ ! -z $lastVerFile ]] && [[ ! -z $latestVer ]]; then
echo "latest version $latestVer > $lastVerFile"
echo $latestVer > "$lastVerFile"
fi
else
return 1
fi
shName=$(echo "$name" | awk '{print tolower($0)}')
find "${toolsPath}/launchers/" -type f -iname "$shName.sh" -o -type f -iname "$shName-emu.sh" | \
while read -r f
do
echo "deleting $f"
rm -f "$f"
done
find "${EMUDECKGIT}/tools/launchers/" -type f -iname "$shName.sh" -o -type f -iname "$shName-emu.sh" | \
while read -r l
do
echo "deploying $l"
launcherFileName=$(basename "$l")
chmod +x "$l"
cp -v "$l" "${toolsPath}/launchers/"
chmod +x "${toolsPath}/launchers/"*
createDesktopShortcut "$HOME/.local/share/applications/$altName.desktop" \
"$altName Binary" \
"${toolsPath}/launchers/$launcherFileName" \
"false"
done
}