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

    Checking if another scriptmodule is installed

    Scheduled Pinned Locked Moved Ideas and Development
    x11pixelscriptmodulesopengl
    11 Posts 2 Posters 890 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.
    • G
      George
      last edited by

      Hello,

      I'm writing a couple of scriptmodules and I've determined that there are some dependencies and I'm looking for a way to detect them. I've tried searching the forums and Google and Reddit, but haven't found a sufficient answer. Perhaps I'm not searching well enough.

      First and foremost, I'm using the latest RetroPie distribution on a Raspberry Pi 4.

      • With my first script, there is a dependency is making sure X11 / Pixel desktop / LXDE is fully installed. There is a routine in /scriptmodules/supplementary/raspbiantools.sh that installs it. Is there a way to detect that it's installed and then exit / display an appropriate error message to the user?
      • With my second script, there's a dependency on making sure that the first script has run and the first set of applications is installed. Is there any mechanism (besides hard coding it myself) for the second script to determine if the first script has successfully performed its installation (and display an appropriate error message if it has not)?
      • Is there a way to rectify these dependencies by actually running the dependent scripts? I.e. Can the second script detect the first script has run, otherwise run the first script, and the first script would detect if X11 is installed, and if not install it? I see rp_callModule in raspbiantools.sh, but is that the best way to go?
      • Finally, I've found that the version of libGL.so on RetroPie is 1.7.0 (This may or may not have been installed when I installed X11). When I download and compile Mesa on my own, it creates a libGL.so with version 1.2.0. The programs I'm running actually don't work with 1.7.0 and work with 1.2.0. Is the installed version something that is maintained by the RetroPie team? I can override libGL.so during execution so it's not the biggest problem, but then I'll be asking questions on where the best place to install it will be.
      • As I've said above, I'm working on a Raspberry Pi 4. I believe that this will be the only board (other than an X86 board) powerful enough to run the applications I'm looking to run. How can I use rp_module_flags to restrict the scriptmodule only to RP4? Is it something like rp_module_flags="rpi4"? I've typically only seen disqualifying flags such as rp_module_flags="!mali".

      I hope I've provided enough detail here. Thanks in advance for your help!

      • George
      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @George
        last edited by mitu

        With my first script, there is a dependency is making sure X11 / Pixel desktop / LXDE is fully installed. There is a routine in /scriptmodules/supplementary/raspbiantools.sh that installs it. Is there a way to detect that it's installed and then exit / display an appropriate error message to the user?

        Usually this is handled by dependencies - if your scriptmodule needs X11 installed, then it needs to declare it and will be installed automatically.

        With my second script, there's a dependency on making sure that the first script has run and the first set of applications is installed. Is there any mechanism (besides hard coding it myself) for the second script to determine if the first script has successfully performed its installation (and display an appropriate error message if it has not)?

        You can use the rp_isInstalled function to check if another module is installed and take the appropriate actions.

        Is there a way to rectify these dependencies by actually running the dependent scripts? I.e. Can the second script detect the first script has run, otherwise run the first script, and the first script would detect if X11 is installed, and if not install it? I see rp_callModule in raspbiantools.sh, but is that the best way to go?

        You can run rp_installModule as part of the dependency chain to make sure you have the right depenencies.

        Finally, I've found that the version of libGL.so on RetroPie is 1.7.0 (This may or may not have been installed when I installed X11). When I download and compile Mesa on my own, it creates a libGL.so with version 1.2.0. The programs I'm running actually don't work with 1.7.0 and work with 1.2.0. Is the installed version something that is maintained by the RetroPie team? I can override libGL.so during execution so it's not the biggest problem, but then I'll be asking questions on where the best place to install it will be.

        libGL is part of the system's packages (libgl1), RetroPie doesn't maintain it. Why do you need to download/compile Mesa ?

        As I've said above, I'm working on a Raspberry Pi 4. I believe that this will be the only board (other than an X86 board) powerful enough to run the applications I'm looking to run. How can I use rp_module_flags to restrict the scriptmodule only to RP4? Is it something like rp_module_flags="rpi4"? I've typically only seen disqualifying flags such as rp_module_flags="!mali".

        You can exclude based on the platform or the platform flags - so if you want to exclude any Pi < 4, you can use !videocore or just x86 rpi4. !mali excludes the boards that use the Mali video drivers (Tinkerboard or Odroid). See systems.sh for a list of platforms and their flags.

        1 Reply Last reply Reply Quote 0
        • G
          George
          last edited by

          Thank you @mitu!

          I will check out rp_isInstalled and rp_installModule and follow up if I have any questions. Same with the platform flags

          libGL is part of the system's packages (libgl1), RetroPie doesn't maintain it. Why do you need to download/compile Mesa ?

          For some reason, the application I'm running does not work with the system package version. The version numbers are also strange. System packages of 19.3.2 with libGL.so.1.7.0, where my git checkout is 20.1.7 with libGL.so.1.2.0. Considering GL seems to be pretty crucial to everything else in the system, I'd rather not disturb it. I'll need to do more investigation to understand where the disparity lies. Thank you for the info though!

          • George
          1 Reply Last reply Reply Quote 0
          • G
            George
            last edited by

            Ok, it seems that the libgl1 that comes with Raspberry Pi OS is actually the libglvnd version (Vendor-Neutral Dispatch) version from https://github.com/NVIDIA/libglvnd. So this would be a distinct version from the one from the Mesa3D org from https://gitlab.freedesktop.org/mesa/mesa/. That would explain the version number differences.

            The problem may in fact not be libgl1 but libgl1-mesa-dri. The one I have on my box is from: http://archive.raspberrypi.org/debian/pool/main/m/mesa/libgl1-mesa-dri_19.3.2-1~bpo10+1~rpt1_armhf.deb but I spotted http://raspbian.raspberrypi.org/raspbian/pool/main/m/mesa/libgl1-mesa-dri_20.1.7-1+rpi1_armhf.deb which is dated September 9. I'm not yet able to install it, but the version numbers line up. Perhaps this will be resolved soon.

            1 Reply Last reply Reply Quote 0
            • mituM
              mitu Global Moderator
              last edited by

              @George said in Checking if another scriptmodule is installed:

              I spotted http://raspbian.raspberrypi.org/raspbian/pool/main/m/mesa/libgl1-mesa-dri_20.1.7-1+rpi1_armhf.deb which is dated September 9.

              Those might be from the experimental/staging repo - not yet install-able.

              1 Reply Last reply Reply Quote 0
              • G
                George
                last edited by

                @mitu said in Checking if another scriptmodule is installed:

                Those might be from the experimental/staging repo - not yet install-able.

                Yes. I think you might be right. Hopefully the RPi foundation will be making progress on this soon. I tried to see if compiling mesa-19.3.2 would work and it did not, so there must be some new things in 20.1.7 that fix those issues. Exciting. Love fewer dependencies. :-)

                @mitu can you provide some guidance as to the syntax of rp_isInstalled? I'm trying things like the following and nothing so far seems to make any difference.

                if rp_isInstalled "retroarch"; then
                if ! rp_isInstalled "retroarch"; then
                if rp_isInstalled "foobartest"; then
                if ! rp_isInstalled "foobartest"; then
                if rp_isInstalled "143"; then
                if ! rp_isInstalled "!143"; then
                

                I've looked in other scripts which have the following syntax:

                if ! rp_isInstalled "$md_idx"; then
                

                Where I'd change $md_idx to the module ID that I'm trying to detect. But that doesn't seem to work either. Very likely I am doing something wrong. I appreciate the help!

                Thanks again,

                - George

                1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator
                  last edited by

                  Something like this works for me:

                  local dep_idx="$(rp_getIdxFromId "lr-ppsspp")"
                  if ! rp_isInstalled "$dep_idx" ; then
                          echo "is not installed"
                  fi
                  
                  1 Reply Last reply Reply Quote 0
                  • G
                    George
                    last edited by

                    Thanks @mitu, that helped!

                    I did discover that rp_isInstalled will still return true if passed a blank value from rp_getIdxFromId, so I made a slight modification:

                    local dep_idx="$(rp_getIdxFromId "SOMEPACKAGE")"
                    if [ "$dep_idx" == "" ] || ! rp_isInstalled "$dep_idx" ; then
                        md_ret_errors+=("Sorry, you need to install the [SOMEPACKAGE] scriptmodule")
                        return 1
                    fi
                    

                    Also, since the Pixel desktop installation isn't through a typical scriptmodule, but through Raspbian Tools, is there a way to detect that?

                    Thanks!

                    - George

                    mituM 1 Reply Last reply Reply Quote 0
                    • mituM
                      mitu Global Moderator @George
                      last edited by

                      @George said in Checking if another scriptmodule is installed:

                      Also, since the Pixel desktop installation isn't through a typical scriptmodule, but through Raspbian Tools, is there a way to detect that?

                      It depends - do you need to full desktop or just the xorg server installed ? See how the steamlink module manages that, it installs xorg and a minimal window manager.

                      G 1 Reply Last reply Reply Quote 0
                      • G
                        George @mitu
                        last edited by

                        That is a good question. I will have to test to see if Steamlink's methods work for my needs. Thanks for the suggestion!

                        - George

                        1 Reply Last reply Reply Quote 0
                        • G
                          George
                          last edited by

                          Just a quick update. The Steamlink script module was a great help in both the minimal window manager as well as installing Ports.

                          Thank you! My questions have been answered.

                          - George

                          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.