RetroPie Auto Startup Script

Hey guys,

When selecting RetroPie as the startup from dietpi-autostart, what script is being used and where is it located in order to call up emulationstation?

I’m looking to inject a few commands right before emulationstation begins in order to connect a few wii remotes via wminput.

Here she is :slight_smile:


That’s what I’m talking about. Thanks!

Hey Fourdee,

I hate to revive this thread, but the issue I just noticed involves the auto startup script.

Alright, so currently the autostart calls the emulationstation binary directly, which works nice until a user decides to use the Quit menu within emulationstation. The user would not be able to restart or shutdown the system nor restart emulationstation. All selections would lead to emulationstation closing out to the terminal.

My solution is this, instead of having the login script call the emulationstation binary directly like this:

#RetroPie/Emulation station
elif (( $AUTO_START_INDEX == 3 )); then
    #emulationstation - can no longer be run as root

The emulationstation script should be called instead, which then calls the binary:


The looks like this:


esdir="$(dirname $0)"
while true; do
    rm -f /tmp/es-restart /tmp/es-sysrestart /tmp/es-shutdown
    "$esdir/emulationstation" "$@"
    [ -f /tmp/es-restart ] && continue
    if [ -f /tmp/es-sysrestart ]; then
        rm -f /tmp/es-sysrestart
        sudo reboot
    if [ -f /tmp/es-shutdown ]; then
        rm -f /tmp/es-shutdown
        sudo poweroff

I found that the emulationstation binary ends up creating a temp file acting like a flag for the shutdown/restart options. During the shutdown of emulationstation, one of the three files is created by the binary and then analyzed by the script.

I found this out with a little help from the Retropie community in the following thread and figured I should share the knowledge:


Excellent, thank you for letting us know.

I’ll update the login script to use /opt/retropie/supplementary/emulationstation/ for v137.

Hello, I would like to ask if I select Retropie on autostart, is there an option to go back to retropie?