2022-08-30 16:26:13 -04:00
#!/bin/bash
2023-11-30 16:20:28 -05:00
MSG = $HOME /emudeck/logs/msg.log
2022-09-24 18:58:09 -04:00
echo "0" > " $MSG "
2022-08-30 16:26:13 -04:00
#
##
## Pid Lock...
##
#
2022-09-24 18:58:09 -04:00
mkdir -p " $HOME /.config/EmuDeck "
2023-10-23 07:39:52 -04:00
mkdir -p " $HOME /emudeck/logs "
2022-09-24 18:58:09 -04:00
PIDFILE = " $HOME /.config/EmuDeck/install.pid "
2022-08-30 16:26:13 -04:00
if [ -f " $PIDFILE " ] ; then
PID = $( cat " $PIDFILE " )
ps -p " $PID " > /dev/null 2>& 1
if [ $? -eq 0 ] ; then
echo "Process already running"
exit 1
else
## Process not found assume not running
echo $$ > " $PIDFILE "
if [ $? -ne 0 ] ; then
echo "Could not create PID file"
exit 1
fi
fi
else
echo $$ > " $PIDFILE "
if [ $? -ne 0 ] ; then
echo "Could not create PID file"
exit 1
fi
fi
function finish {
echo " Script terminating. Exit code $? "
finished = true
rm " $MSG "
2023-09-07 14:23:57 -04:00
2022-08-30 16:26:13 -04:00
}
trap finish EXIT
#
##
2023-09-07 14:23:57 -04:00
## Init...
2022-08-30 16:26:13 -04:00
##
#
#Clean up previous installations
rm ~/emudek.log 2>/dev/null # This is emudeck's old log file, it's not a typo!
rm -rf ~/dragoonDoriseTools
2022-09-24 18:58:09 -04:00
rm -rf ~/emudeck/backend
2022-08-30 16:26:13 -04:00
#Creating log file
2023-10-23 07:36:26 -04:00
LOGFILE = " $HOME /emudeck/logs/emudeckSetup.log "
2022-08-30 16:26:13 -04:00
2022-09-26 17:42:31 -04:00
mkdir -p " $HOME /emudeck "
2022-10-14 15:33:19 -04:00
#Custom Scripts
mkdir -p " $HOME /emudeck/custom_scripts "
echo $'#!/bin/bash\nEMUDECKGIT="$HOME/.config/EmuDeck/backend"\nsource "$EMUDECKGIT/functions/all.sh"' > " $HOME /emudeck/custom_scripts/example.sh "
2022-09-25 16:47:56 -04:00
echo "Press the button to start..." > " $LOGFILE "
2022-09-10 12:50:34 -04:00
2023-10-23 07:36:26 -04:00
mv " ${ LOGFILE } " " $HOME /emudeck/logs/emudeckSetup.last.log " #backup last log
2022-08-30 16:26:13 -04:00
2022-09-26 17:42:31 -04:00
if echo " ${ @ } " > " ${ LOGFILE } " ; then
echo "Log created"
else
exit
fi
2023-02-25 16:57:26 -05:00
#exec > >(tee "${LOGFILE}") 2>&1
#Installation log
{
2022-08-30 16:26:13 -04:00
date "+%Y.%m.%d-%H:%M:%S %Z"
#Mark if this not a fresh install
2022-09-24 18:58:09 -04:00
FOLDER = " $HOME /.config/EmuDeck/ "
2022-08-30 16:26:13 -04:00
if [ -d " $FOLDER " ] ; then
2022-09-24 18:58:09 -04:00
echo "" > " $HOME /.config/EmuDeck/.finished "
2022-08-30 16:26:13 -04:00
fi
sleep 1
2022-09-24 18:58:09 -04:00
SECONDTIME = " $HOME /.config/EmuDeck/.finished "
2022-08-30 16:26:13 -04:00
2023-02-01 11:09:34 -05:00
#Lets log github API limits just in case
echo 'Github API limits:'
curl -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/rate_limit"
2022-08-30 16:26:13 -04:00
#
##
## set backend location
##
# I think this should just be in the source, so there's one spot for initialization. hrm, no i'm wrong. Here is best.
2022-09-24 18:58:09 -04:00
EMUDECKGIT = " $HOME /.config/EmuDeck/backend "
2022-08-30 16:26:13 -04:00
#
##
## Start of installation
2023-10-02 12:54:38 -04:00
##
2022-08-30 16:26:13 -04:00
#
source " $EMUDECKGIT /functions/all.sh "
2022-10-05 22:47:01 -04:00
#after sourcing functins, check if path is empty.
2023-11-22 14:29:49 -05:00
# [[ -z "$emulationPath" ]] && { echo "emulationPath is Empty!"; setMSG "There's been an issue, please restart the app"; exit 1; }
2022-10-05 22:47:01 -04:00
2022-08-30 16:26:13 -04:00
2022-10-05 22:47:01 -04:00
echo "Current Settings: "
grep -vi pass " $emuDecksettingsFile "
2022-08-30 16:26:13 -04:00
#
#Environment Check
#
echo ""
echo "Env Details: "
getEnvironmentDetails
testRealDeck
#this sets up the settings file with defaults, in case they don't have a new setting we've added.
#also echos them all out so they are in the log.
echo "Setup Settings File: "
2023-10-02 12:54:38 -04:00
createUpdateSettingsFile
2022-08-30 16:26:13 -04:00
2022-10-05 22:47:01 -04:00
#create folders after tests!
createFolders
2022-08-30 16:26:13 -04:00
#setup Proton-Launch.sh
#because this path gets updated by sed, we really should be installing it every time and allowing it to be updated every time. In case the user changes their path.
cp " $EMUDECKGIT /tools/proton-launch.sh " " ${ toolsPath } /proton-launch.sh "
chmod +x " ${ toolsPath } /proton-launch.sh "
2022-09-22 23:53:42 -04:00
cp " $EMUDECKGIT /tools/appID.py " " ${ toolsPath } /appID.py "
2022-08-30 16:26:13 -04:00
2022-12-28 15:45:26 -05:00
# Setup emu-launch.sh
cp " ${ EMUDECKGIT } /tools/emu-launch.sh " " ${ toolsPath } /emu-launch.sh "
chmod +x " ${ toolsPath } /emu-launch.sh "
2022-08-30 16:26:13 -04:00
#ESDE Installation
2023-11-30 16:27:21 -05:00
if [ $doInstallESDE = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "install esde"
2023-10-02 12:54:38 -04:00
ESDE_install
2022-08-30 16:26:13 -04:00
fi
2023-10-06 11:04:40 -04:00
#Pegasus Installation
2023-11-30 16:27:21 -05:00
if [ $doInstallPegasus = "true" ] ; then
2023-10-06 11:04:40 -04:00
echo "install Pegasus"
Pegasus_install
fi
2022-08-30 16:26:13 -04:00
#SRM Installation
2023-11-30 16:27:21 -05:00
if [ $doInstallSRM = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "install srm"
SRM_install
fi
2023-11-30 16:27:21 -05:00
if [ " $doInstallPCSX2QT " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "install pcsx2Qt"
PCSX2QT_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallPrimeHack = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "install primehack"
Primehack_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallRPCS3 = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "install rpcs3"
RPCS3_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallCitra = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "install Citra"
Citra_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallDolphin = "true" ] ; then
2023-10-02 12:54:38 -04:00
echo "install Dolphin"
2022-08-30 16:26:13 -04:00
Dolphin_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallDuck = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "DuckStation_install"
DuckStation_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallRA = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "RetroArch_install"
2023-10-02 12:54:38 -04:00
RetroArch_install
2022-08-30 16:26:13 -04:00
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallRMG = "true" ] ; then
2023-01-03 00:46:29 -05:00
echo "RMG_install"
2023-10-02 12:54:38 -04:00
RMG_install
2023-01-03 00:46:29 -05:00
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallares = "true" ] ; then
2023-06-01 17:47:22 -04:00
echo "ares_install"
2023-10-02 12:54:38 -04:00
ares_install
2023-06-01 17:47:22 -04:00
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallPPSSPP = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "PPSSPP_install"
2023-10-02 12:54:38 -04:00
PPSSPP_install
2022-08-30 16:26:13 -04:00
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallYuzu = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Yuzu_install"
Yuzu_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallRyujinx = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Ryujinx_install"
Ryujinx_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallMAME = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "MAME_install"
MAME_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallXemu = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Xemu_install"
Xemu_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallCemu = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Cemu_install"
Cemu_install
fi
2023-11-30 16:27:21 -05:00
if [ " ${ doInstallCemuNative } " = "true" ] ; then
2023-01-23 23:03:12 -05:00
echo "CemuNative_install"
CemuNative_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallScummVM = "true" ] ; then
2022-09-24 04:29:49 -04:00
echo "ScummVM_install"
ScummVM_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallVita3K = "true" ] ; then
2022-09-24 04:29:49 -04:00
echo "Vita3K_install"
Vita3K_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallMGBA = "true" ] ; then
2023-02-02 16:18:11 -05:00
echo "mGBA_install"
mGBA_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallFlycast = "true" ] ; then
2023-06-29 02:58:52 -04:00
echo "Flycast_install"
Flycast_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallRMG = "true" ] ; then
2023-02-05 14:56:15 -05:00
echo "RMG_install"
RMG_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallares = "true" ] ; then
2023-06-01 17:47:22 -04:00
echo "ares_install"
ares_install
fi
2023-11-30 16:27:21 -05:00
if [ $doInstallmelonDS = "true" ] ; then
2023-02-07 11:12:49 -05:00
echo "melonDS_install"
melonDS_install
2023-02-05 14:56:15 -05:00
fi
2022-08-30 16:26:13 -04:00
#Xenia - We need to install Xenia after creating the Roms folders!
2023-11-30 16:27:21 -05:00
if [ " $doInstallXenia " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Xenia_install"
Xenia_install
fi
#Steam RomManager Config
2023-11-30 16:27:21 -05:00
if [ " $doSetupSRM " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "SRM_init"
SRM_init
fi
#ESDE Config
2023-11-30 16:27:21 -05:00
if [ " $doSetupESDE " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "ESDE_init"
ESDE_update
2023-10-02 12:54:38 -04:00
fi
2022-08-30 16:26:13 -04:00
2023-10-06 11:04:40 -04:00
#Pegasus Config
2023-11-30 16:27:21 -05:00
#if [ $doSetupPegasus = "true" ]; then
2023-10-10 16:20:54 -04:00
# echo "Pegasus_init"
# Pegasus_init
#fi
2023-10-06 11:04:40 -04:00
2022-08-30 16:26:13 -04:00
#Emus config
#setMSG "Configuring Steam Input for emulators.." moved to emu install
setMSG "Configuring emulators.."
2023-11-30 16:27:21 -05:00
if [ " $doSetupRA " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "RetroArch_init"
RetroArch_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupPrimehack " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Primehack_init"
Primehack_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupDolphin " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Dolphin_init"
Dolphin_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupPCSX2QT " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "PCSX2QT_init"
PCSX2QT_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupRPCS3 " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "RPCS3_init"
RPCS3_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupCitra " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Citra_init"
Citra_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupDuck " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "DuckStation_init"
DuckStation_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupYuzu " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Yuzu_init"
Yuzu_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupRyujinx " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Ryujinx_init"
Ryujinx_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupPPSSPP " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "PPSSPP_init"
PPSSPP_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupXemu " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Xemu_init"
Xemu_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupMAME " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "MAME_init"
MAME_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupScummVM " = "true" ] ; then
2022-09-24 04:29:49 -04:00
echo "ScummVM_init"
ScummVM_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupVita3K " = "true" ] ; then
2022-09-24 04:29:49 -04:00
echo "Vita3K_init"
Vita3K_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupRMG " = "true" ] ; then
2023-02-05 14:56:15 -05:00
echo "RMG_init"
RMG_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupares " = "true" ] ; then
2023-06-01 17:47:22 -04:00
echo "ares_init"
ares_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupmelonDS " = "true" ] ; then
2023-02-07 11:12:49 -05:00
echo "melonDS_init"
melonDS_init
2023-02-05 14:56:15 -05:00
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupMGBA " = "true" ] ; then
2023-02-02 16:18:11 -05:00
echo "mGBA_init"
mGBA_init
fi
2023-11-30 16:27:21 -05:00
if [ " ${ doSetupCemuNative } " = "true" ] ; then
2023-01-23 23:03:12 -05:00
echo "CemuNative_init"
CemuNative_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupFlycast " = "true" ] ; then
2023-06-29 02:58:52 -04:00
echo "Flycast_init"
Flycast_init
fi
2022-08-30 16:26:13 -04:00
#Proton Emus
2023-11-30 16:27:21 -05:00
if [ " $doSetupCemu " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Cemu_init"
Cemu_init
fi
2023-11-30 16:27:21 -05:00
if [ " $doSetupXenia " = "true" ] ; then
2022-08-30 16:26:13 -04:00
echo "Xenia_init"
Xenia_init
fi
#Fixes repeated Symlink for older installations
# Yuzu_finalize move into update / init to clean up install script
#
##
##End of installation
##
#
#Sudo Required!
2023-11-14 10:11:28 -05:00
# if [ -n "$PASSWD" ]; then
# pwstatus=0
# echo "$PASSWD" | sudo -v -S &>/dev/null && pwstatus=1 || echo "sudo password was incorrect" #refresh sudo cache
2023-11-30 16:27:21 -05:00
# if [ $pwstatus = 1 ]; then
# if [ "$doInstallGyro" = "true" ]; then
2023-11-14 10:11:28 -05:00
# Plugins_installSteamDeckGyroDSU
# fi
#
2023-11-30 16:27:21 -05:00
# if [ "$doInstallPowertools" = "true" ]; then
2023-11-14 10:11:28 -05:00
# Plugins_installPluginLoader
# Plugins_installPowerTools
# fi
# fi
# else
# echo "no password supplied. Skipping gyro / powertools."
# fi
2022-08-30 16:26:13 -04:00
#Always install
BINUP_install
CHD_install
#
##
## Overrides for non Steam hardware...
##
#
#
#Fixes for 16:9 Screens
#
2023-11-30 16:27:21 -05:00
if [ " $doSetupRA " = "true" ] ; then
if [ " $( getScreenAR) " = 169 ] ; then
2023-10-02 12:54:38 -04:00
nonDeck_169Screen
2022-10-31 19:39:16 -04:00
fi
2023-10-02 12:54:38 -04:00
2022-10-31 19:39:16 -04:00
#Anbernic Win600 Special configuration
2023-11-30 16:27:21 -05:00
if [ " $( getProductName) " = "Win600" ] ; then
2023-10-02 12:54:38 -04:00
nonDeck_win600
2022-10-31 19:39:16 -04:00
fi
2022-10-21 15:46:14 -04:00
fi
2023-11-30 16:27:21 -05:00
if [ " $system " = "chimeraos" ] ; then
2023-11-02 14:43:11 -04:00
mkdir -p $HOME /Applications
downloads_dir = " $HOME /Downloads "
destination_dir = " $HOME /Applications "
file_name = "EmuDeck"
2023-11-30 11:24:44 -05:00
mkdir -p $destination_dir
2023-11-02 14:43:11 -04:00
find " $downloads_dir " -type f -name " * $file_name *.AppImage " -exec mv { } " $destination_dir / $file_name .AppImage " \;
2023-11-30 11:24:44 -05:00
chmod +x " $destination_dir /EmuDeck.AppImage "
2023-11-02 14:43:11 -04:00
fi
2022-10-21 15:46:14 -04:00
2022-08-30 16:26:13 -04:00
createDesktopIcons
2023-11-30 16:27:21 -05:00
if [ " $doInstallHomeBrewGames " = "true" ] ; then
2022-12-12 06:30:29 -05:00
emuDeckInstallHomebrewGames
fi
2022-09-10 20:27:29 -04:00
2022-08-30 16:26:13 -04:00
#
##
##Validations
##
#
2023-11-30 08:14:35 -05:00
if [ " $system " != "darwin" ] ; then
2023-11-22 14:29:49 -05:00
#Decky Plugins
2023-11-30 16:27:21 -05:00
if [ " $system " = "chimeraos" ] ; then
2023-11-22 14:29:49 -05:00
defaultPass = "gamer"
2023-11-13 18:15:35 -05:00
else
2023-11-22 14:29:49 -05:00
defaultPass = "Decky!"
2023-11-13 18:15:35 -05:00
fi
2023-11-30 08:14:35 -05:00
if ( echo " $defaultPass " | sudo -S -k true ) ; then
echo $defaultPass | sudo -v -S && {
Plugins_installEmuDecky $defaultPass
2023-11-30 16:27:21 -05:00
if [ " $system " = "chimeraos" ] ; then
2023-11-30 08:14:35 -05:00
Plugins_installPowerControl $defaultPass
else
Plugins_installPowerTools $defaultPass
fi
Plugins_installSteamDeckGyroDSU $defaultPass
Plugins_installPluginLoader $defaultPass
}
fi
2023-11-22 14:29:49 -05:00
fi
2022-09-10 20:43:57 -04:00
2022-08-30 16:26:13 -04:00
#EmuDeck updater on gaming Mode
2023-11-30 08:14:35 -05:00
#mkdir -p "${toolsPath}/updater"
#cp -v "$EMUDECKGIT/tools/updater/emudeck-updater.sh" "${toolsPath}/updater/"
#chmod +x "${toolsPath}/updater/emudeck-updater.sh"
2022-08-31 11:44:41 -04:00
#RemotePlayWhatever
2023-11-30 16:27:21 -05:00
# if [[ ! $branch = "main" ]]; then
2022-09-19 14:30:48 -04:00
# RemotePlayWhatever_install
# fi
2022-08-30 16:26:13 -04:00
#
2023-10-02 12:54:38 -04:00
# We mark the script as finished
2022-08-30 16:26:13 -04:00
#
2022-09-24 18:58:09 -04:00
echo "" > " $HOME /.config/EmuDeck/.finished "
echo "" > " $HOME /.config/EmuDeck/.ui-finished "
2023-11-30 16:20:28 -05:00
echo "100" > " $HOME /emudeck/logs/msg.log "
echo "# Installation Complete" >> " $HOME /emudeck/logs/msg.log "
2022-08-30 16:26:13 -04:00
finished = true
rm " $PIDFILE "
2022-10-14 15:21:11 -04:00
#
## We check all the selected emulators are installed
#
checkInstalledEmus
2022-10-14 15:33:19 -04:00
#
# Run custom scripts... shhh for now ;)
#
2022-10-14 18:29:42 -04:00
for entry in " $HOME " /emudeck/custom_scripts/*.sh
2022-10-14 15:33:19 -04:00
do
bash $entry
done
2023-10-02 12:54:38 -04:00
} | tee " ${ LOGFILE } " 2>& 1