• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login

shell scripting topic

Scheduled Pinned Locked Moved Ideas and Development
shellshell scriptprogramming
191 Posts 10 Posters 76.2k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    meleu @lilbud
    last edited by 1 Oct 2017, 19:55

    @lilbud where is placed the script with that line of code? maybe you have to use the full path to the overlay.cfg.

    • Useful topics
    • joystick-selection tool
    • rpie-art tool
    • achievements I made
    L 1 Reply Last reply 1 Oct 2017, 19:58 Reply Quote 0
    • L
      lilbud @meleu
      last edited by 1 Oct 2017, 19:58

      @meleu I believe it is placed in the overlay directory.

      opt/retropie/configs/all/retroarch/overlay

      Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

      Backlog: http://backloggery.com/lilbud

      C 1 Reply Last reply 1 Oct 2017, 20:12 Reply Quote 0
      • C
        cyperghost @lilbud
        last edited by cyperghost 10 Jan 2017, 21:14 1 Oct 2017, 20:12

        @lilbud Just start coding use echo commands to show results in your bash
        You can test sedcommands directly from CLI and results will be marked red.
        Don't use -i parameter for testing... it will directly write to input file and may give unwantend results. If you want create altered files then work with direction > output-file first.

        If all works then use -i

        L 1 Reply Last reply 1 Oct 2017, 22:47 Reply Quote 0
        • L
          lilbud @cyperghost
          last edited by 1 Oct 2017, 22:47

          @cyperghost Ok, I can get the original command to replace the text, but only if both fields are specified.

          sed -i 's/01.png/08.png/g' overlay.cfg

          This works fine, 01.png is replaced with 08.png. But what would I put in the first field if the overlay name is not 01.png. Something like this?:

          sed -i 's/${FILENAME}.png/08.png/g' overlay.cfg

          Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

          Backlog: http://backloggery.com/lilbud

          M C 2 Replies Last reply 2 Oct 2017, 04:04 Reply Quote 0
          • M
            mitu Global Moderator @lilbud
            last edited by 2 Oct 2017, 04:04

            @lilbud You can use a wildcard:

            sed -i 's/.*.png/08.png/g' overlay.cfg
            

            Note that this will replace any <filename>.png in the file with 08.png.

            1 Reply Last reply Reply Quote 1
            • C
              cyperghost @lilbud
              last edited by 2 Oct 2017, 06:01

              @lilbud I'm still not sure what your goal is.
              Anwer yourself:

              1. Where is the overlay.cfg located?
              2. In which case do you want to alter overlays?
              3. Is there a "system" in altering names (Maybe $EMU-$ROMNAME-$TAG.png?)

              Imho ... here's is a good script that writes several information in /boot/config.txt and checks existance of data before.

              For graphics menu layout you can use this it uses arrays for graphics menu and here is a Howto for dialog/whiptail usage.

              Here is the RetroPie wiki and how to input paramters into your script.

              L M 2 Replies Last reply 2 Oct 2017, 09:45 Reply Quote 0
              • L
                lilbud @cyperghost
                last edited by lilbud 10 Feb 2017, 10:51 2 Oct 2017, 09:45

                @cyperghost okay

                • Overlay.cfg located in default directory, /opt/retrofit/configs/all/retroarch/overlay

                • The point of the script is to provide a way a to switch and choose the overlay from the retropie menu in ES.

                • So choosing overlay named, '08.png, will do a few things. It will check for an overlay in use. If one is found, then the cfg file will be modified to show the path of the wanted overlay.png, (/my/awesome/overlay/8.png).

                • Once the overlay is selected, the main retroarch.cfg will be modified with the viewport settings and the overlay.

                Anything else needing further explanation?

                Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                Backlog: http://backloggery.com/lilbud

                C 1 Reply Last reply 2 Oct 2017, 10:28 Reply Quote 0
                • C
                  cyperghost @lilbud
                  last edited by 2 Oct 2017, 10:28

                  @lilbud No I understood.
                  All the links I've provided to you will help you to code this.
                  Just start over with the selection menu ;)

                  L 1 Reply Last reply 2 Oct 2017, 10:36 Reply Quote 0
                  • L
                    lilbud @cyperghost
                    last edited by 2 Oct 2017, 10:36

                    @cyperghost If I can find a way to get the script done during class, I'll see if I can work on it.

                    I think there is bash on my school computer...

                    Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                    Backlog: http://backloggery.com/lilbud

                    C 1 Reply Last reply 2 Oct 2017, 10:38 Reply Quote 0
                    • C
                      cyperghost @lilbud
                      last edited by 2 Oct 2017, 10:38

                      @lilbud
                      Bash? School computer?

                      Code on your Pie!
                      All you need is a SSH terminal and nanoas editor

                      So you I would do the following.

                      1. You write a selection menu that provides a layout for selected system and save it to config
                      2. You write an "enabler" that sets overlay according to choosen system

                      ;)

                      L 1 Reply Last reply 2 Oct 2017, 10:47 Reply Quote 0
                      • L
                        lilbud @cyperghost
                        last edited by 2 Oct 2017, 10:47

                        @cyperghost I don't have access to my pi in school, besides, the schools network is locked to any device that isn't a school issued computer.

                        Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                        Backlog: http://backloggery.com/lilbud

                        1 Reply Last reply Reply Quote 0
                        • M
                          meleu @cyperghost
                          last edited by 2 Oct 2017, 11:22

                          @cyperghost said in shell scripting topic:

                          For graphics menu layout you can use this

                          I'm afraid that a scriptmodule isn't a good example for starters ;-)

                          @lilbud said in shell scripting topic:

                          Anything else needing further explanation?

                          Yes, post your code in ghostbin or something so we can give more effective guidance.

                          • Useful topics
                          • joystick-selection tool
                          • rpie-art tool
                          • achievements I made
                          L C 2 Replies Last reply 2 Oct 2017, 11:30 Reply Quote 0
                          • L
                            lilbud @meleu
                            last edited by 2 Oct 2017, 11:30

                            @meleu I'll have to redo it today, I'll post a link later.

                            Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                            Backlog: http://backloggery.com/lilbud

                            1 Reply Last reply Reply Quote 0
                            • C
                              cyperghost @meleu
                              last edited by cyperghost 10 Feb 2017, 13:07 2 Oct 2017, 12:04

                              @meleu Yes but for the sake of coding style

                              choice=$(dialog --command1 --command2 --menulist \
                                      1 Option 1 \
                                      2 Option 2 \
                                      redirection to ....)
                              

                              is better coded in this script menu example ;)

                              dialogcmd=(dialog --command1 --command2 --menu)
                              dialogoptions=("1" "Option 1" "2" "Option 2")
                              choice=$("${dialogcmd[@]}" "${dialogoptions[@]}" redirection to)
                              

                              And it will be much easier for bug hunting. Because structur here is clear. And this was my intention to bring this script module into game.
                              dialogcmd sets the structure of how the menu will looks like as array
                              dialogoptions is the data array for selection
                              and now with choice you put cmd and options together.

                              And I think this is a good example of clean coding ;)
                              Of course @lilbud will choose his own flavour later

                              1 Reply Last reply Reply Quote 1
                              • L
                                lilbud
                                last edited by 2 Oct 2017, 13:58

                                @meleu @cyperghost Here is my plan for the script: https://ghostbin.com/paste/6bbsa

                                not much in the way of code since I don't have a way to write/test it on my school computer.

                                Creator of the Radiocade: https://retropie.org.uk/forum/topic/6077/radiocade

                                Backlog: http://backloggery.com/lilbud

                                1 Reply Last reply Reply Quote 0
                                • H
                                  hiulit
                                  last edited by 8 Oct 2017, 20:10

                                  Hi there!

                                  I've created my first shell script and I'd like your opinion, codewise.
                                  It's a script to install some extras for RetroPie themes (icons, splashscreens and launching images).

                                  The code is here: https://github.com/hiulit/es-theme-extras/blob/master/es-theme-extras.sh

                                  I've created a post on this forum https://retropie.org.uk/forum/topic/13344/extras-for-retropie-themes-icons-splashscreens-and-launching-images-es_theme_extras-shell-script You can check it out to see more details.

                                  Thanks! :)

                                  My little contributions to the RetroPie project:

                                  • Shell-Script-Boilerplate
                                  • Fun-Facts-Splashscreens
                                  • Limit-Last-Played-Games
                                  M 1 Reply Last reply 8 Oct 2017, 21:38 Reply Quote 1
                                  • M
                                    meleu @hiulit
                                    last edited by 8 Oct 2017, 21:38

                                    @hiulit I saw that post. That's a pretty cool idea. I'm just a little busy with RL stuff, but I'll take a look at that soon. ;-)

                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    H 1 Reply Last reply 9 Oct 2017, 13:42 Reply Quote 1
                                    • H
                                      hiulit @meleu
                                      last edited by 9 Oct 2017, 13:42

                                      @meleu I'm glad you think it's a good idea! :D I think so too, but it would need every theme creator to get involved. We'll see if more people find it useful.

                                      My little contributions to the RetroPie project:

                                      • Shell-Script-Boilerplate
                                      • Fun-Facts-Splashscreens
                                      • Limit-Last-Played-Games
                                      C 1 Reply Last reply 10 Oct 2017, 12:43 Reply Quote 0
                                      • C
                                        cyperghost @hiulit
                                        last edited by 10 Oct 2017, 12:43

                                        @hiulit Welcome on board ;)

                                        H 1 Reply Last reply 10 Oct 2017, 13:51 Reply Quote 1
                                        • H
                                          hiulit @cyperghost
                                          last edited by 10 Oct 2017, 13:51

                                          @cyperghost Thanks! :)

                                          My little contributions to the RetroPie project:

                                          • Shell-Script-Boilerplate
                                          • Fun-Facts-Splashscreens
                                          • Limit-Last-Played-Games
                                          1 Reply Last reply Reply Quote 1
                                          102 out of 191
                                          • First post
                                            102/191
                                            Last post

                                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.

                                            This community forum collects and processes your personal information.
                                            consent.not_received