Alternative to Kodi packages: Modroot

  • You want to start hacking on your device running LibreELEC but creating Kodi packages sounds overkilled to you? Then this might be for you.
    You want to distribute your cool new tool to many users? Then use Kodi packages, please.

    What this does? Well, it creates a folder structure

    Code
    ~/modroot
    ~/modroot/bin
    ~/modroot/lib
    ~/modroot/etc


    and integrates this into LibreELEC. You can start all binaries from ~/modroot/bin without specifying the directory, libraries in ~/modroot/lib will be picked up automatically (in fact you're even able to overwrite LibreELECs libraries by placing them there) and ~/modroot/etc is for config files (here you're able to overwrite LibreELECs buildins, too).

    So how does it work? Simple: It's all a single shell script that you use as autostart file (~/.config/autostart.sh). Here it is:

    Wait, how to use autostart now? Just use ~/modroot/bin/autostart - It can be a binary, a shell script or anything other executable by LibreELEC.

    Edited once, last by V10lator (July 9, 2016 at 12:25 PM).


  • Interesting. By the way "Risk" is spelled with a k.


    Thanks, fixed.


    why not just overlay the entire rootfs, then you wouldn't have to change the LD_LIBRARY_PATH or PATH at all


    Cause the script started with PATH and LD_LIBRARY_PATH changes only, /etc support was added in later on. Also it might be a little bit faster that way (I didn't benchmark). Anyway, feel free to change it however you want.

  • just a heads up i can not get this to work on le 7.0.2 MR. the script runs and creates the diretory struture and /modroot/bin/autostart is runs.
    but modroot/bin or modroot/lib is not added to PATH or LD_LIBRARY_PATH after booting, and /etc/profile.d/9999-modroot.conf is not created either.
    i think the culprit must be 9999-modroot.conf since this dir is read only? (i tried creating a file there)

    Edited once, last by tuxen (July 10, 2016 at 4:55 AM).


  • i think the culprit must be 9999-modroot.conf since this dir is read only? (i tried creating a file there)

    Thanks for the report. :) /etc should be read-write thanks to the overlay, so what happens if you execute the following line manually:

    Code
    mount -t overlay overlay -o lowerdir=/etc,upperdir=/storage/modroot/etc,workdir=/storage/modroot/.work /etc


    ?

  • sorry, i am stupid. i can see now that it was a bad line wrap in the copy/paste.
    works fine. wanted a quick way to store 'certain things' away the normal rootfs, and stumbled upon this before i even thought about writing a script.
    thanks! :)

    Edited once, last by tuxen (July 10, 2016 at 8:58 PM).


  • Would be interesting if LE had overlayfs for / combined with opkg or similar package manager like OpenWrt.

    AFAIK the idea with LE and OE is to have a robust system that can't be (easily) messed up by the users. So having an overlayfs would more or less defeat this idea.

  • I disagree that an overlay would defeat that idea. Worst case scenario, a wipe of the overlay would restore the system to a working state. It could even be optional with a warning. I think most users wouldn't even notice, as they aren't even aware of SSH. It does add complexity though, and might not be a good idea security wise as Kodi and it's addons have root access. The upside would be the possibility for proper package management and more community packages.