Useful bash scripts for use on RetroPie systems
Download the scripts:
cd ~
git clone https://github.com/bverc/retropie-scripts scripts
restart emulationstation.sh
Restart Emulation Stationsafe shutdown.sh
Perform safe shutdown of the systemtoggle bluetooth.sh
Turn Bluetooth on or offtoggle wifi.sh
Turn wifi on or offtoggle mute.sh
Mute or Unmute speakersvolume up.sh
Increase volume by 10%volume down.sh
Decrease volume by 10%
cd scripts
bash toggle\ mute.sh
Symlink scripts into retropiemenu folder so they are accessable from the Emulation Station menus
ln -s ~/scripts/toggle\ mute.sh ~/RetroPie/retropiemenu/
Create a new system in Emulation Station so all scripts appear in their own group.
Copy default es_systems.cfg and edit to ensure it is not replaced during upgrade
sudo cp /etc/emulationstation/es_systems.cfg /opt/retropie/configs/all/emulationstation/es_systems.cfg
sudo vi /opt/retropie/configs/all/emulationstation/es_systems.cfg
Add the following system entry:
<system>
<name>scripts</name>
<fullname>Scripts</fullname>
<path>/home/pi/scripts</path>
<extension>.sh</extension>
<command>bash %ROM%</command>
<platform/>
<theme>scripts</theme>
</system>
restart emulationstation or reboot
If you wish, you can create a theme for the new system
Run a python script to run a bash script on GPIO button press. Some examples are provided:
gpio-script.py
maps scripts to GPIOs and runs script each time paired GPIO is pressedgpio-shutdown.py
detects button press, waits 2 seconds and checks again before shutting down system
To run at boot, add to crontab.
crontab -e
At the bottom of the file, add the line:
@reboot python /home/pi/scripts/gpio-script.py
reboot