2022-03-27 13:30:22 +00:00
#!/bin/bash
2022-03-30 14:14:43 +00:00
# Steam Deck SD path: /run/media/mmcblk0p1
is_mounted( ) {
mount | awk -v DIR = " $1 " '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}'
}
2022-03-28 13:01:47 +00:00
# if we got the .lock file it means that it's not a first run
if [ ! -f ~/retrodeck/.lock ]
then
2022-03-31 06:03:00 +00:00
kdialog --title "RetroDECK" --yes-label "Internal" --no-label "SD Card" --yesno "Where do you want your rom folder to be located?"
if [ $? = = 0 ] #yes - Internal
2022-03-30 14:14:43 +00:00
then
roms_folder = ~/retrodeck/roms
else #no - SD Card
if is_mounted "/run/media/mmcblk0p1"
then
roms_folder = /run/media/mmcblk0p1/retrodeck/roms
2022-04-01 13:29:44 +00:00
mkdir -p /run/media/mmcblk0p1/retrodeck/
2022-03-30 14:14:43 +00:00
else
kdialog --title "RetroDECK" --error "SD Card is not readable, please check if it inserted or mounted correctly and run RetroDECK again."
exit 0
fi
fi
2022-03-31 06:03:00 +00:00
2022-03-31 11:50:46 +00:00
# initializing ES-DE
2022-03-31 06:03:00 +00:00
2022-03-31 11:50:46 +00:00
mkdir -p /var/config/retrodeck/tools
# Cleaning
rm -rf /var/config/emulationstation/
rm ~/retrodeck/bios
rm /var/config/retrodeck/tools/*
kdialog --title "RetroDECK" --msgbox "EmulationStation will now initialize the system, please don't edit the rom location.\nJust select CREATE DIRECTORIES, YES, QUIT buttons.\nRetroDECK will manage the rest."
mkdir -p /var/config/emulationstation/
emulationstation --home /var/config/emulationstation
mv /var/config/emulationstation/ROMs /var/config/emulationstation/ROMs.bak
ln -s $roms_folder /var/config/emulationstation/ROMs
mv /var/config/emulationstation/ROMs.bak $roms_folder
2022-03-30 14:14:43 +00:00
2022-03-31 11:50:46 +00:00
# XMLSTARLET HERE
cp /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml
2022-03-29 14:48:17 +00:00
2022-03-28 13:01:47 +00:00
mkdir -p ~/retrodeck/saves
mkdir -p ~/retrodeck/states
mkdir -p ~/retrodeck/screenshots
2022-03-29 14:48:17 +00:00
2022-03-30 14:14:43 +00:00
cp -r /app/retrodeck/tools/* /var/config/retrodeck/tools
2022-03-29 14:48:17 +00:00
2022-03-28 15:00:21 +00:00
mkdir -p /var/config/retroarch/system
2022-03-31 06:03:00 +00:00
ln -s ~/.var/app/com.xargon.retrodeck/config/retroarch/system ~/retrodeck/bios
2022-03-31 11:50:46 +00:00
2022-03-28 13:01:47 +00:00
cp /app/retrodeck/retrodeck-retroarch.cfg /var/config/retroarch/retroarch.cfg
2022-03-31 11:50:46 +00:00
mkdir -p /var/config/emulationstation/.emulationstation/gamelists/tools/
cp /app/retrodeck/tools-gamelist.xml /var/config/emulationstation/.emulationstation/custom_systems/tools/gamelist.xml
2022-03-30 14:14:43 +00:00
mkdir -p /var/config/retroarch/cores/
cp /app/share/libretro/cores/* /var/config/retroarch/cores/
2022-03-31 11:50:46 +00:00
2022-03-28 13:01:47 +00:00
touch ~/retrodeck/.lock
2022-03-31 06:03:00 +00:00
kdialog --title "RetroDECK" --msgbox " Initialization completed, please put your roms in: $roms_folder .\nIf you wish to change the roms location you may use the tool located the tools section of RetroDECK. "
2022-03-31 11:50:46 +00:00
else
emulationstation --home /var/config/emulationstation
fi