This script will help you to install RetroArch from a Lakka image to an already working OS LibreELEC with Kodi.
Original post:
https://forum.libreelec.tv/thread/29500-libreelec-kodi-lakka-retroarch
Connect to LibreElec device by ssh.
ssh root@LibreElecOnce there, run the script.
wget -q -O - https://raw.githubusercontent.com/basilean/retroarch_install/refs/heads/main/retroarch_install.sh | bashIt takes approx 25 minutes to complete.
Now you have a RetroArch link in your favourites, click on it and wait 5 seconds (first time takes longer).
Download the script.
wget -q https://raw.githubusercontent.com/basilean/retroarch_install/refs/heads/main/retroarch_install.shEdit it.
vi retroarch_install.shVERSION=6.x-20250207-0af7daeIt needs to be a valid version from releases or nightly.
https://github.com/libretro/Lakka-LibreELEC/releases
https://nightly.builds.lakka.tv/latest
DIR_INSTALL=${HOME}/retroarchDestination for retroarch.
Also used as temporal over installation by default.DIR_TMP=${DIR_INSTALL}/tmp
DEVICE=
ARCH=Empty DEVICE or ARCH will get it from the "/etc/release" file.
Run it.
bash retroarch_install.shRemove install directory.
${DIR_INSTALL}
Usually: /storage/retroarch
Remove link.
${HOME}/.config/retroarch
Usually: /storage/.config/retroarch
Edit systemd service.
vi /storage/.config/system.d/retroarch.serviceChange this line adding arguments.
ExecStart=/storage/retroarch/retroarch -v --log-file=/tmp/retroarch.logReload systemd
systemctl daemon-reloadNext time you run it it will create log file.
tail /tmp/retroarch.logI wrote this script to help download BIOS from a Internet Archive collection.
wget -q -O - https://raw.githubusercontent.com/basilean/retroarch_install/refs/heads/main/retrobios_install.py | python3It came from the original post.
Create a wrapper script to handle environment variables for service.
vi /storage/retroex.sh echo "SYSTEM=${1}" > /tmp/iagl.conf # Manual for list.
echo "ROM=${2}" >> /tmp/iagl.conf # XXROM_PATHXX
systemctl start retroarchMake it executable.
chmod 755 /storage/retroex.shChange service
vi /storage/.config/system.d/retroarch.service# Comment old exec line.
# ExecStart=/storage/retroarch/retroarch
# Add script output file with vars.
EnvironmentFile=/tmp/iagl.conf
# Customize retroarch init flags to your like!
ExecStart=/storage/retroarch/retroarch -L ${SYSTEM} ${ROM}Remember to reload systemd
systemctl daemon-reloadWhen set external command for a list at IAGL, follow this pattern:
/storage/retroex.sh SYSTEM "ROM"SYSTEM -> Whatever goes with -L indicating core to use, set it manually for that list.
ROM -> It is replaced by iagl with rom path of your choice. Note that is important to use quotes to avoid issues with white spaces.
NOTE: XXROM_PATHXX is an IAGL meta variable representing rom path.
/storage/retroex.sh fbneo "XXROM_PATHXX"