Homepage › Forums › RetroPie Project › Everything else related to the RetroPie Project › Running scripts with ES
- This topic has 2 replies, 2 voices, and was last updated 10 years, 12 months ago by petrockblog.
-
AuthorPosts
-
11/05/2013 at 15:34 #3081AnonymousInactive
I posted this in a comment before I noticed there is a forum for this stuff. I moved it over here where it should be.
I’ve set up a couple “systems” in es_systems.cfg to provide for “programs” and “admin” menus in emulationstation. I did this so I can launch XBMC, the X desktop, and some terminal based admin stuff like software updates, raspi-config, retro-config, change default desktop environment, etc. The examples I found on youtube to do this use files that end in .app, and have no shebang at the top, but appear to just be a script with no mention of a command interpreter. That is, the contents of xbmc.app is just one line, “sudo xbmc-standalone”. Everything works well enough this way but I would like to change resolution when I run tasks in the terminal using “tvservice -e (CEA 3)”, etc. I’m having problem getting this to work reliably. Changing resolution didn’t seem to work unless I used a proper shell script with shebang at the top, but scripts don’t seem to run as expected. They work best when all the commands are strung together with &&, but when I put each command on a newline it stops working. I also made 2 more scripts named res1.sh and res2.sh, and running those from new lines seems to work in some cases, not in others. I looked at the way runcommand.sh sort of wraps the resolution change around a command line arguement and thought I could do something similar, but I would prefer that the res change only apply to some of the “roms” for this “system” rather than for the whole system, so I prefer not to use something similar to runcommand.sh in es_systems.cfg.
—-es_systems.cfg entry—-
DESCNAME=Administration
NAME=admin
PATH=/home/pi/RetroPie/roms/admin
EXTENSION=.app .sh
COMMAND=%ROM%—–raspiconfig.sh script (AKA the %ROM%)—-
#!/bin/bash
clear
tvservice -e “CEA 3”
fbset -xres 720 -yres 480
fbset -depth 8 && fbset -depth 16
sudo raspi-config
tvservice -e “CEA 4”
fbset -xres 1280 -yres 720
fbset -depth 8 && fbset -depth 16The example above will not work unless the tvservice and fbset commands are in a seperate scripts, or if the whole things is strung into one command with &&. What little I know about scripting commands tells me that I should be able to do the same thing several different ways and get the same results, but that doesn’t seem to be the case. Is there a better way to go about doing this? Am I doing somethign wrong?
I saw in another thread someone suggests COMMAND=bash %ROM%. Would this work better?
11/13/2013 at 01:16 #3149AnonymousInactiveOK. After about a week of double checking paths and filenames over and over, combing for typos, and anything else that would explain why some scripts work and some don’t…I finally resolved the problem. I renamed the troublesome scripts, created new fresh text files with the original script names, copied the exact contents of the original scripts into the new scripts, and made them executable. Now they suddenly work just like they should.
It seems not all text files are created equal, especially those that I created on a windows machine and sent to the Pi via sftp. For some reason this resulted in files that wouldn’t execute even though they were executable, and instead resulted in “filename not found”, even though I could see the file right there in the folder.
Now I can go about adding some more options to emulationstation like raspi-config, RetroPie-Setup, software updates, reboot, etc. Next I would like to figure out if I can have emulationstation launch different xsession/DEs. I can skip running startx and run xfce4-session instead and that works..but so far no luck with startlxde or lxsession unless I change my default DE. It seems like I should be able to run one or the other without having to change the default.
11/13/2013 at 07:11 #3150petrockblogKeymasterGlad to hear!
It would be great, if you could post your working script(s) here :-) In this way, others might get some inspiration.
-
AuthorPosts
- The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.