Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy files from distro's stub filesystem and cli update script #7540

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

antonlacon
Copy link
Contributor

This adds a DISTRIBUTION level filesystem to copy files into the image, similar to the existing PROJECT or DEVICE filesystems. I went to use this and found it didn't already exist.

Busybox's package.mk has been serving this role solely. Some of the scripts attached to busybox get edited by sed on install, but others are drop in files. This should be able to serve those files.

The show_config commit is to use the DISTRO_DIR var instead of hardcoding the path.

@antonlacon antonlacon changed the title Distro filesystem Copy files from distro's stub filesystem Feb 25, 2023
@antonlacon
Copy link
Contributor Author

Added a commit with the CLI update script which I intended to make use of this.

The script is self-contained; one may copy it to /storage for testing. Its logic prioritizes as follows:

Installed releases series -> latest bugfix release in series (it's willing to download the update the .tar file in this case)
If running a nightly -> checks for a newer release in that series (by timestamp, requires new releases.json format to work)
If on latest bugfix release -> latest release for the running device (will not download, points to libreelec.tv for release notes)

So...
LE 11.0.0 would upgrade to 11.0.1 (or higher point release)
LE11 nightly from before 11.0.1 would upgrade to 11.0.1 (once new releases.json is deployed)
LE11 would print a message saying to go to the website when LE12 comes.
If LE12 and a hypothetical 11.0.5 is out, but user is on 11.0.0, it would want to upgrade to 11.0.5 before acknowledging LE12 existed.

@antonlacon antonlacon changed the title Copy files from distro's stub filesystem Copy files from distro's stub filesystem and cli update script Mar 22, 2023
@antonlacon antonlacon force-pushed the distro-filesystem branch 2 times, most recently from 722017d to 49f0008 Compare May 15, 2023 22:02
@antonlacon
Copy link
Contributor Author

Added a commit that changes the URL it looks for releases.json to https://releases.libreelec.tv/releases_v2.json. If that URL 404s, then it falls back to https://releases.libreelec.tv/releases.json. The URL may still be overridden with the --json option.

The change in release.json format is needed before the canary waiting period or updating from a nightly to stable works (or having update files in subdirectories). The script will fail gracefully / has overrides until then.

The script is self-contained. Copy it to /storage and run to test. Edit L285 or so to set ARCHITECTURE, VERSION and VERSION_ID to pretend to be different devices or on a non-devel version. ex:

ARCHITECTURE = 'RPi2.arm'
VERSION = '11.0.0'
VERSION_ID = '11.0'

Current release.json:

LibreELEC:~ # ./update-system -v
ARCHITECTURE='RPi2.arm'
DISTRIBUTION='LibreELEC'
VERSION='11.0.0'
VERSION_ID='11.0'
Failed to download releases.json: https://releases.libreelec.tv/releases_v2.json
Falling back to: https://releases.libreelec.tv/releases.json
Found update file: http://releases.libreelec.tv/LibreELEC-RPi2.arm-11.0.1.tar
Unable to determine testing period of update. Holding update back. Use --force to proceed anyway.
update_available=False
update_major=False
update_location=None
No eligible system updates found to apply.
LibreELEC:~ # ./update-system -v -f
ARCHITECTURE='RPi2.arm'
DISTRIBUTION='LibreELEC'
VERSION='11.0.0'
VERSION_ID='11.0'
Failed to download releases.json: https://releases.libreelec.tv/releases_v2.json
Falling back to: https://releases.libreelec.tv/releases.json
Found update file: http://releases.libreelec.tv/LibreELEC-RPi2.arm-11.0.1.tar
update_available=True
update_major=False
update_location='http://releases.libreelec.tv/LibreELEC-RPi2.arm-11.0.1.tar'
System update found. Use --upgrade to apply.
LibreELEC:~ # ./update-system -v -f -u
ARCHITECTURE='RPi2.arm'
DISTRIBUTION='LibreELEC'
VERSION='11.0.0'
VERSION_ID='11.0'
Failed to download releases.json: https://releases.libreelec.tv/releases_v2.json
Falling back to: https://releases.libreelec.tv/releases.json
Found update file: http://releases.libreelec.tv/LibreELEC-RPi2.arm-11.0.1.tar
update_available=True
update_major=False
update_location='http://releases.libreelec.tv/LibreELEC-RPi2.arm-11.0.1.tar'
Downloading: http://releases.libreelec.tv/LibreELEC-RPi2.arm-11.0.1.tar
Download finished.
Copying LibreELEC-RPi2.arm-11.0.1.tar to /storage/.update
Download complete. Reboot to continue the update.
LibreELEC:~ # ls .update/
LibreELEC-RPi2.arm-11.0.1.tar

New format json (second run has canary forced to 1000 days - 10.0.3 is "current" in my mock archive):

LibreELEC:~ # ./update-system -v -j /storage/releases.json
ARCHITECTURE='RPi2.arm'
DISTRIBUTION='LibreELEC'
VERSION='10.0.2'
VERSION_ID='10.0'
Found update file: https://releases.libreelec.tv/LibreELEC-RPi2.arm-10.0.3.tar
update_available=True
update_major=False
update_location='https://releases.libreelec.tv/LibreELEC-RPi2.arm-10.0.3.tar'
System update found. Use --upgrade to apply.
LibreELEC:~ # nano -Ec update-system
LibreELEC:~ # ./update-system -v -j /storage/releases.json
ARCHITECTURE='RPi2.arm'
DISTRIBUTION='LibreELEC'
VERSION='10.0.2'
VERSION_ID='10.0'
Found update file: https://releases.libreelec.tv/LibreELEC-RPi2.arm-10.0.3.tar
Update held until 2025-09-23 04:46:35 for general availability.
update_available=False
update_major=False
update_location=None
No eligible system updates found to apply.

@antonlacon
Copy link
Contributor Author

Fixed minor issues revealed by pylint. Added checking sha256sums to file downloading.

@CvH CvH removed the LE 12.0 label Mar 12, 2024
@antonlacon antonlacon force-pushed the distro-filesystem branch 2 times, most recently from e36fe5e to 7987d01 Compare March 24, 2024 23:04
@antonlacon
Copy link
Contributor Author

Added --nightly to pull latest nightly build for the device. For uboot images, it picks the first of the available uboot images to use for updating.

Some other miscellaneous cleanups. Needs to squash before it's merged.

This allows creating $DISTRO_DIR/$DISTRO/filesystem/ as a location
to store files that should be copied to the image similar to how it
is done for PROJECT or DEVICE filesystems.

Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants