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

    Add Option to Execute Bash OR Python scripts onstart and onend

    Scheduled Pinned Locked Moved Ideas and Development
    runcommandpython
    18 Posts 6 Posters 4.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.
    • C
      corezon @BuZz
      last edited by

      @BuZz Having a one line script to execute another script is amazingly sloppy. If you're reluctant to call additional script types directly, how about giving us the option to specify the script that is run?

      BuZzB meleuM 2 Replies Last reply Reply Quote -1
      • BuZzB
        BuZz administrators @corezon
        last edited by

        @corezon I'm not going to change it.

        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

        1 Reply Last reply Reply Quote 1
        • meleuM
          meleu @corezon
          last edited by

          @corezon said in Add Option to Execute Bash OR Python scripts onstart and onend:

          how about giving us the option to specify the script that is run?

          This option already exists. Just specify the script you want to run in runcommand-onstart.sh (or -onend.sh).

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          C 1 Reply Last reply Reply Quote 2
          • C
            corezon @meleu
            last edited by

            @meleu Yes. But again, having a one-line script to execute another script is just silly. Where as everyone seems to enjoy finding ways to turn down a new idea in this thread, adding two options to runcommand.cfg would both satisfy the request and open up a ton of new options for those who want to extend their RetroPies.

            BuZzB suprjamiS meleuM Drakaen391D 4 Replies Last reply Reply Quote -2
            • BuZzB
              BuZz administrators @corezon
              last edited by BuZz

              @corezon opens up a ton of new options? No it doesn't. It just pleases you as you don't want to launch it in the way we have suggested. It's a pointless change imho.

              To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

              1 Reply Last reply Reply Quote 1
              • suprjamiS
                suprjami @corezon
                last edited by suprjami

                @corezon said in Add Option to Execute Bash OR Python scripts onstart and onend:

                Yes. But again, having a one-line script to execute another script is just silly.

                Man you're going to be real upset when you discover how the EmulationStation autostart works.

                The kernel doesn't care about executable file extensions. When one of the exec() system calls is made against a file, as long as the file being executed starts with a shebang then the specified interpreter is run.

                For example, here is test.sh but it's actually a Python script:

                $ cat test.sh 
                #!/usr/bin/python
                print "hello"
                

                So you can just run it and it works:

                $ ./test.sh 
                hello
                

                You can see the kernel literally just checks for the presence of # followed by ! then runs whatever it's told to: http://lxr.linux.no/linux+*/fs/binfmt_script.c

                So if you really have such a problem launching a bash script to launch your Python script, call your Python script runcommand-onstart.sh/runcommand-onend.sh and make sure it has the Python shebang at the start. Done.

                BuZzB 1 Reply Last reply Reply Quote 0
                • BuZzB
                  BuZz administrators @suprjami
                  last edited by BuZz

                  @suprjami Although that won't work in this case since we specifically call bash rather than just trying to execute the script. Intentionally done, so nothing breaks when people decide to move their script to a fat32 usb drive and back or mess with the permissions etc (We do the same with other launch scripts as this problem cropped up before when people had their roms folder on fat32).

                  As you point out when we autostart ES, we launch a bash script, which launches another bash script which launches ES ;-) Then when launching a port, ES launches a bash script which launches runcommand, which launches something. So really it will make no "difference" and as we are not doing it in a loop 10,000 times, there is no reason to change it.

                  To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                  suprjamiS 1 Reply Last reply Reply Quote 2
                  • suprjamiS
                    suprjami @BuZz
                    last edited by

                    @BuZz I hear Leonadro Di Caprio has signed up for a new movie, it is called Inception 2: Linux Bash Scripts ;)

                    1 Reply Last reply Reply Quote 3
                    • BuZzB
                      BuZz administrators
                      last edited by

                      I'm not sure which is more worrying.. your sense of humour or my appreciation of it ;-)

                      To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                      1 Reply Last reply Reply Quote 1
                      • meleuM
                        meleu
                        last edited by meleu

                        Maybe it's one of those strange Usopp's diseases (from the One Piece manga).

                        usoppdisease

                        http://imgur.com/LTRIHTY

                        • Useful topics
                        • joystick-selection tool
                        • rpie-art tool
                        • achievements I made
                        1 Reply Last reply Reply Quote 1
                        • meleuM
                          meleu @corezon
                          last edited by

                          @corezon putting a little better my point of view...
                          On my joystick-selection tool, when using the joystick selection by name method the tool adds a single line to the runcommand-onstart.sh and the logic is actually done by another shell script. I did this way because I want to let the runcommand-onstart.sh available to the user tweaking.

                          I have had this experience of receiving some harsh words from the main developer. It's a bit shocking at first, but then we get used to his tough-guy style. :-) You have to provide really useful use cases and be really careful with your words. At least that's the way I've been doing and have achieved some satisfactory results... ;-)

                          Can you provide one of those new options that would be possible by adding it to runcommand.cfg that can not be achieved by the current method?

                          • Useful topics
                          • joystick-selection tool
                          • rpie-art tool
                          • achievements I made
                          BuZzB 1 Reply Last reply Reply Quote 0
                          • BuZzB
                            BuZz administrators @meleu
                            last edited by BuZz

                            @meleu I don't think you got any harsh words (tbh I think I was quite polite) from me but perhaps it was because of you of making unnecessary personal remarks about me like the one above.

                            Not to mention posting a link where to download roms, making demands, and not accepting when I said I didn't want to do something - eg when I didn't accept your offer to document the code. (That's not how it works - you don't get to dictate where the project is going - if you want it to work differently, you can fork it).

                            Ideas are welcome, and feel free to put your argument across, but if I think something should be done differently, please accept it.

                            To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                            1 Reply Last reply Reply Quote 0
                            • Drakaen391D
                              Drakaen391 @corezon
                              last edited by

                              @corezon not sure you understand how operating systems work....

                              scripts run off of scripts.... in Ubuntu for example, the startup scripts are actually ran from systemd and its set of scripts....

                              unless you change the kernal, you will always run a script from a script...

                              just how operating systems work

                              RPi B & RPi 3B OC (Now Raspberry pi 4b 8gb)
                              Retropie (Latest Stable)
                              PiBox with Wind Tunnel Cooling System

                              C 1 Reply Last reply Reply Quote 2
                              • C
                                corezon @Drakaen391
                                last edited by

                                @Drakaen391 Yes, I am aware that scripts can launch scripts and do quite often. The idea of a single line bash script just to execute a python script is pretty silly though.

                                The matter is closed though. The devs aren't interested in the idea which is their right.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  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.