creating default contents for storage directory during clean install

  • I would like to modify the default contents in the storage directory following a clean install. I attempted to modify the SYSTEM image using squashfs tools and creating a new md5sum file for my modified SYSTEM image. But the contents I placed in squashfs-root/storage/ do not get unzipped properly during the install. I'm guessing because storage is a separate partition and probably does not get mounted before SYSTEM is unpacked...


    Specifically, I would like to create my own custom .kodi directory and .config directory


    Can anyone help me figure out how I would need to modify the LIBREELEC partition so that my custom .kodi and .config directories can be unpacked into the storage partition after a clean install.


    Thank you

  • One option would be to unpack some archive from first partition using shell script post-sysroot.sh. After unpacking remove archive to make sure unpacking is done only once. But this would only work if archive is not very big.


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • One option would be to unpack some archive from first partition using shell script post-sysroot.sh. After unpacking remove archive to make sure unpacking is done only once. But this would only work if archive is not very big.

    where is post-sysroot.sh located? Or do I need to create it? I was not able to find it inside the SYSTEM squashfs or the LIBREELEC partition....

  • No, you would put this file and compressed archive on FAT partition (first one). But you should be careful with a script not to break boot process. And archive must be extracted only on second boot after storage resizing (when file .please_resize_me doesn't exist anymore).


    Ah, just forget my suggestion. It is to complicated :D Maybe it doesn't even work as I though. The file should be mount-storage.sh and storage partition must be manually mounted from this script.


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • No, you would put this file and compressed archive on FAT partition (first one). But you should be careful with a script not to break boot process. And archive must be extracted only on second boot after storage resizing (when file .please_resize_me doesn't exist anymore).


    Ah, just forget my suggestion. It is to complicated :D Maybe it doesn't even work as I though. The file should be mount-storage.sh and storage partition must be manually mounted from this script.

    I don't mind complicated. I'm a newbie to libreelec, but I am an experienced linux user.


    I am looking to maintain the .please_resize_me functionality so I can put my custom image on sd cards of variable size and keep my image small. Unfortunately .please_resize_me fails to run if there are other contents in the storage partition.


    I think the best way would be to extract my archive right after the resizing and before the reboot. What script handles the resizing? I can't find mount_storage.sh inside the SYSTEM squashfs...

  • You just need to check if file please_resize_me exists. If it does then resizing has not been done yet. And when it doesn't exist then you need to extract archive.


    But why do you even need this thing? Can't you just restore some initial config with LE restore function?


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • OK I found it: /usr/lib/libreelec/fs-resize


    at the end of the script I tried replacing:

    reboot -f &>/dev/null


    with:

    mount /dev/mmcblk0p2 /storage

    cd /storage

    unzip /var/mystuff.zip

    sync

    umount /storage

    reboot -f &>/dev/null


    But it didn't work out... I did confirm that /usr/mystuff.zip exists, so it does appear that my custom SYSTEM image works, and I also examined fs-resize, and it is my custom version as well. So there is some type of issue with the execution of my commands.


    The resize did happen, the 15 second counter counted down, but my archive was not unzipped into /storage, or perhaps /storage was never successfully mounted. I did not see any error messages on screen...



    I am doing this so I can quickly create a brand new box for myself whenever I want with max efficiency, no manual labor

  • You didn't mention that you are using self build image! In this case you can do whatever you want.


    For including addons I played with this Add Build 7zip (for .7z files) to image


    You could use something similar. Or just make some new service which runs soon enough.


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • it was just a stupid typo on my part lol. as you can see from my post...


    I initially planned to put mystuff.zip in the /var directory, but then changed my mind and put it in /usr


    however I didn't update my custom fs-resize with the new location as you can see in my post


    I fixed my custom fs-resize and everything worked as I hoped :)


    thank you for your advice, much appreciated