From 7e378b248a1c8bde9c06fd7a7ddd7020294e1f94 Mon Sep 17 00:00:00 2001
From: ABeltramo <beltramo.ale@gmail.com>
Date: Mon, 15 Jul 2024 18:38:28 +0100
Subject: [PATCH] fix: retroarch, added missing 7z and autoconfig

---
 images/retroarch/Dockerfile         | 2 +-
 images/retroarch/scripts/startup.sh | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/images/retroarch/Dockerfile b/images/retroarch/Dockerfile
index 6d71d357..023a0966 100644
--- a/images/retroarch/Dockerfile
+++ b/images/retroarch/Dockerfile
@@ -10,7 +10,7 @@ RUN apt-get update && \
     add-apt-repository ppa:libretro/stable && \
     apt-get update && \
     # Install retroarch \
-    apt-get install -y retroarch && \
+    apt-get install -y retroarch p7zip-full && \
     # Cleanup \
     apt-get remove -y software-properties-common gpg-agent && \
     apt-get autoremove -y && \
diff --git a/images/retroarch/scripts/startup.sh b/images/retroarch/scripts/startup.sh
index da64770b..1d58b165 100644
--- a/images/retroarch/scripts/startup.sh
+++ b/images/retroarch/scripts/startup.sh
@@ -18,10 +18,19 @@ cp -u /cfg/retroarch.cfg "$CFG_DIR/retroarch.cfg"
 
 # if there are no assets, manually download them
 if [ ! -d "$CFG_DIR/assets" ]; then
+    gow_log "Missing assets, downloading..."
     wget -q --show-progress -P /tmp https://buildbot.libretro.com/assets/frontend/assets.zip
     7z x /tmp/assets.zip -bso0 -bse0 -bsp1 -o"$CFG_DIR/assets"
     rm /tmp/assets.zip
 fi
 
+# Add the base autoconfig profile so that it'll pickup joypads automatically
+if [ ! -d "$CFG_DIR/autoconfig" ]; then
+    gow_log "Missing autoconfig, downloading..."
+    wget -q --show-progress -P /tmp https://buildbot.libretro.com/assets/frontend/autoconfig.zip
+    7z x /tmp/autoconfig.zip -bso0 -bse0 -bsp1 -o"$CFG_DIR/autoconfig"
+    rm /tmp/autoconfig.zip
+fi
+
 source /opt/gow/launch-comp.sh
 launcher /usr/bin/retroarch