Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: iOtero on December 26, 2018, 11:31:02 AM

Title: Run a script from Attract-Mode in Linux (lakka)
Post by: iOtero on December 26, 2018, 11:31:02 AM
Let's see if any of you know how to do this.

I want to launch a script from Attract-Mode on Linux, in this case it's openELEC or Lakka, so i can get information about the system on the screen, but i do not get anything.

The script is this, and by ssh with the putty it works perfectly, but from Attract-Mode i do not know if it does something or not, because nothing remains on the screen.

Code: [Select]
#!/bin/bash
clear
echo "----------- SPACE -----------"
df -h
echo "----------- MEMORY -----------"
free -m
echo "----------- TEMPERATURE -----------"
vcgencmd measure_temp
echo "----------- IP -----------"
ip route get 8.8.8.8 2>/dev/null | awk '{print $NF; exit}'
echo "----------- EXIT -----------"
read -n 1 -s -r -p "Press any key to continue"

This another script runs perfectly:

Code: [Select]
#!/bin/bash
cd /usr/bin
retroarch

And the two have this romlist:

Code: [Select]
retroarch;RetroArch;Extras;;;;;;;;;;;;;;
systeminfo;System Information;Extras;;;;;;;;;;;;;;

and this configuration:

Code: [Select]
executable      /bin/bash
args            "[romfilename]"
rompath $HOME/systems/extras/roms
system Extras
romext .sh
artwork flyer $HOME/systems/extras/flyer
artwork marquee $HOME/systems/extras/marquee
artwork snap $HOME/systems/extras/snap
artwork wheel $HOME/systems/extras/wheel

I'm not a great expert in linux, and maybe you have to give some more command to display the information on the screen, i do not know.


I remind everyone that the biggest complication of working with lakka is that you have to compile Attract-Mode (and any other application) first in raspbian and then copy it with all your lakka libraries, since lakka does not allow native compilation or installation nor update anything that can not be done from within RetroArch or Attract-Mode. Take it into account when making any contribution to this topic.

Thanks in advance for the help.

Note: Yes, i am working on a fully operational Attract-Mode img with Retroarch in Lakka for Raspberry Pi, without Batocera, Retropie, Recalbox or Emulationstation.

Title: Re: Run a script from Attract-Mode in Linux (lakka)
Post by: keilmillerjr on December 26, 2018, 12:57:05 PM
The only way I can think of to get data passed to attractmode is to write output to a file and have attractmode’s squirrels read the file.
Title: Re: Run a script from Attract-Mode in Linux (lakka)
Post by: iOtero on December 27, 2018, 05:00:00 AM
The only way I can think of to get data passed to attractmode is to write output to a file and have attractmode’s squirrels read the file.

It's a good idea, now to see if I can develop it.
Title: Re: Run a script from Attract-Mode in Linux (lakka)
Post by: iOtero on December 27, 2018, 05:25:05 AM
I modified the script like this:
Code: [Select]

#!/bin/bash
clear
echo "----------- SPACE -----------" >> info.txt
df -h >> info.txt
echo "----------- MEMORY -----------" >> info.txt
free -m >> info.txt
echo "----------- TEMPERATURE -----------" >> info.txt
vcgencmd measure_temp >> info.txt
echo "----------- IP -----------" >> info.txt
ip route get 8.8.8.8 2>/dev/null | awk '{print $NF; exit}' >> info.txt


And executed from putty, like ./systeminfo.sh, it generates well the file info.txt with the information requested, but from AM, it does not generate it.

There could be some error in the Extras.cfg?

Code: [Select]
executable      /bin/bash
args            "[romfilename]"
rompath $HOME/.systems/extras/roms
system Extras
romext .sh
artwork flyer $HOME/.systems/extras/flyer
artwork marquee $HOME/.systems/extras/marquee
artwork snap $HOME/.systems/extras/snap
artwork wheel $HOME/.systems/extras/wheel

The snaps, wheels, flyers, etc. they look good on the screen.
Title: Re: Run a script from Attract-Mode in Linux (lakka)
Post by: iOtero on December 29, 2018, 10:58:18 AM
Solved, it was a problem of paths and permissions.