2022-04-22 18:34:11 -04:00
#!/bin/bash
2022-11-04 01:54:18 -04:00
2023-06-03 21:04:21 -04:00
linuxID = $( lsb_release -si)
2024-04-28 17:15:06 -04:00
sandbox = ""
2023-10-10 16:20:54 -04:00
if [ $linuxID != "ChimeraOS" ] ; then
2023-06-03 20:35:47 -04:00
2023-06-04 07:05:03 -04:00
echo "installing EmuDeck"
elif [ $linuxID != "SteamOS" ] ; then
2023-06-03 20:35:47 -04:00
2023-10-10 16:20:54 -04:00
2023-06-03 21:04:21 -04:00
zenityAvailable = $( command -v zenity & > /dev/null && echo true )
2023-10-10 16:20:54 -04:00
if [ [ $zenityAvailable = true ] ] ; then
2023-12-29 10:58:03 -05:00
read -r PASSWD <<< " $( zenity --password --title= "Password Entry" --text= "Enter you user sudo password to install required depencies" 2>/dev/null) "
2023-06-03 20:35:47 -04:00
echo " $PASSWD " | sudo -v -S
ans = $?
2023-11-30 16:39:36 -05:00
if [ [ $ans = = 1 ] ] ; then
2023-06-03 20:35:47 -04:00
#incorrect password
2023-12-29 10:58:03 -05:00
read -r PASSWD <<< " $( zenity --password --title= "Password Entry" --text= "Password was incorrect. Try again. (Did you remember to set a password for linux before running this?)" 2>/dev/null) "
2023-06-03 20:35:47 -04:00
echo " $PASSWD " | sudo -v -S
ans = $?
2023-11-30 16:39:36 -05:00
if [ [ $ans = = 1 ] ] ; then
2023-06-03 20:35:47 -04:00
text = " $( printf "<b>Password not accepted.</b>\n Expert mode tools which require a password will not work. Disabling them." ) "
zenity --error \
--title= "EmuDeck" \
--width= 400 \
--text= " ${ text } " 2>/dev/null
setSetting doInstallPowertools false
setSetting doInstallGyro false
fi
fi
fi
2023-10-10 16:20:54 -04:00
2023-06-03 20:35:47 -04:00
SCRIPT_DIR = $( cd -- " $( dirname -- " ${ BASH_SOURCE [0] } " ) " & > /dev/null && pwd )
2023-10-10 16:20:54 -04:00
2023-06-03 20:35:47 -04:00
function log_err {
echo " $@ " >& 2
}
2023-10-10 16:20:54 -04:00
2023-06-03 20:35:47 -04:00
function script_failure {
log_err " An error occurred: $( [ -z " $1 " ] && " on line $1 " || "(unknown)" ) . "
log_err "Installation failed!"
2023-06-03 21:04:21 -04:00
exit
2023-06-03 20:35:47 -04:00
}
2023-10-10 16:20:54 -04:00
2023-06-03 21:04:21 -04:00
#trap 'script_failure $LINENO' ERR
2023-10-10 16:20:54 -04:00
2023-06-03 20:35:47 -04:00
echo "Installing EmuDeck dependencies..."
2023-10-10 16:20:54 -04:00
2023-06-03 21:04:21 -04:00
if command -v apt-get >/dev/null; then
echo "Installing packages with apt..."
2023-09-07 14:23:57 -04:00
DEBIAN_DEPS = "jq zenity flatpak unzip bash libfuse2 git rsync whiptail"
2024-04-28 17:15:06 -04:00
sandbox = " --no-sandbox"
2023-10-10 16:20:54 -04:00
sudo killall apt apt-get
2023-06-03 20:35:47 -04:00
sudo apt-get -y update
sudo apt-get -y install $DEBIAN_DEPS
2023-06-03 21:04:21 -04:00
elif command -v pacman >/dev/null; then
2023-06-03 20:35:47 -04:00
echo "Installing packages with pacman..."
2023-09-07 14:23:57 -04:00
ARCH_DEPS = "steam jq zenity flatpak unzip bash fuse2 git rsync whiptail"
2023-10-10 16:20:54 -04:00
sudo pacman --noconfirm -Syu
2023-07-22 13:11:34 -04:00
sudo pacman --noconfirm -S $ARCH_DEPS
elif command -v dnf >/dev/null; then
echo "Installing packages with dnf..."
2023-12-21 12:58:55 -05:00
FEDORA_DEPS = "jq zenity flatpak unzip bash fuse git rsync newt"
2023-10-10 16:20:54 -04:00
2023-07-22 13:11:34 -04:00
sudo dnf -y upgrade
sudo dnf -y install $FEDORA_DEPS
elif command -v zypper >/dev/null; then
echo "Installing packages with zypper..."
2023-09-07 14:23:57 -04:00
SUSE_DEPS = "steam jq zenity flatpak unzip bash libfuse2 git rsync whiptail"
2023-10-10 16:20:54 -04:00
2023-07-22 13:11:34 -04:00
sudo zypper --non-interactive up
sudo zypper --non-interactive install $SUSE_DEPS
elif command -v xbps-install >/dev/null; then
echo "Installing packages with xbps..."
2023-09-07 14:23:57 -04:00
VOID_DEPS = "steam jq zenity flatpak unzip bash fuse git rsync whiptail"
2023-10-10 16:20:54 -04:00
2023-07-22 13:11:34 -04:00
sudo xbps-install -Syu
sudo xbps-install -Sy $VOID_DEPS
2023-06-03 21:04:21 -04:00
else
log_err " Your Linux distro $linuxID is not supported by this script. We invite to open a PR or help us with adding your OS to this script. https://github.com/dragoonDorise/EmuDeck/issues "
2023-06-03 20:35:47 -04:00
exit 1
fi
2023-06-03 21:04:21 -04:00
2023-10-10 16:20:54 -04:00
2023-06-03 20:35:47 -04:00
# this could be replaced to immediately start the EmuDeck setup script
2023-10-10 16:20:54 -04:00
2023-06-03 20:35:47 -04:00
echo "All prerequisite packages have been installed. EmuDeck will be installed now!"
fi
2022-11-28 15:21:39 -05:00
set -eo pipefail
2022-11-04 01:54:18 -04:00
2022-11-28 15:21:39 -05:00
report_error( ) {
FAILURE = " $( caller ) : ${ BASH_COMMAND } "
echo "Something went wrong!"
echo " Error at ${ FAILURE } "
}
trap report_error ERR
2024-03-07 15:27:56 -05:00
EMUDECK_GITHUB_URL = "https://api.github.com/repos/EmuDeck/emudeck-electron/releases/latest"
2023-04-26 00:10:47 -04:00
EMUDECK_URL = " $( curl -s ${ EMUDECK_GITHUB_URL } | grep -E 'browser_download_url.*AppImage' | cut -d '"' -f 4) "
2022-11-04 01:54:18 -04:00
mkdir -p ~/Applications
curl -L " ${ EMUDECK_URL } " -o ~/Applications/EmuDeck.AppImage 2>& 1 | stdbuf -oL tr '\r' '\n' | sed -u 's/^ *\([0-9][0-9]*\).*\( [0-9].*$\)/\1\n#Download Speed\:\2/' | zenity --progress --title "Downloading EmuDeck" --width 600 --auto-close --no-cancel 2>/dev/null
chmod +x ~/Applications/EmuDeck.AppImage
2024-04-28 17:15:06 -04:00
~/Applications/EmuDeck.AppImage$sandbox
2024-03-08 05:04:30 -05:00
exit