shell script to get the latest nightly (old)

  • Thanks for your work, I have quickly tested the script on RPi 4B and it works in general, but there are some disadvantages I would like to mention:

    - when the download is aborted for some reason, deletion of partially downloaded image is a bad behaviour from my point of view, a better choice should be to use the wget -c so the running script again could continue downloading the rest of the file.

    - the script does not detect the upgrade image (but as a downgrade instead) when there are several images released the same day, like yesterday. FYI there's a folder content & debug output including index.html below:

    thanks for testing and reporting !

    for the last part:

    Today I noticed this as well.

    my script *doesn't* work in this special today case (same image date and diff git tag) as I thought it would.

    => line 155 ff. ?!

    - it's under investigation, needs time ! -


    for the first part:

    I leave the script regrading this part as is !

    why ?

    when the download/the script is aborted there might be a somehow damaged nightly in ~/.update

    what will happen, when the user forgot about it and reboots ?

    I know the update installer does a checksum, but - currently - I don't know what he does afterwards.

    In a best case he denies the update and cleans ~/.update.

    But, *I* can't relay on such assumption and therefore I clean ~/.update explicit.

    feeling more on a safer side !

    Edited 5 times, last by GDPR-7 (June 19, 2022 at 9:21 PM).

  • n case there is a somehow damaged nightly in ~/.update

    what will happen, when the user forgot about it and reboots.

    I know the update installer does a checksum, but - currently - I don't know what he does afterwards.

    In a best case he denies the update and cleans ~/.update.

    AFAIK the update file is removed by LE after the reboot in both cases - when the update file is damaged or complete. The damaged file can't be uncompressed succesfully (and this is checked as you mentioned) so I believe there's no danger.

    I am using wget -c by default as my Internet connectivity is not very stable and fast so I don't need to pull the file from scratch everytime when it fails. It works really great and I had never an issue when updating from such file.

  • "AFAIK" and "I believe" shouldn't be the measurement doing (or trying to do) reliable programming

    sorry !

    you just need to prevent hitting CRTL+C during script run to trigger the need to start from scratch

    but, feel free to adjust the script for your needs ...

  • I want to add that I tested the script yesterday on the rpi3b+ and it worked as advertised. Unfortunately, there was no new build for generic-legacy, so I could not test it there too. I then deleted it and waited for the fixes

    And today that there are new buids for both, the script was removed :D

  • jim_p, I found a bug (what is for update/downgrade) wasn't work as expected

    (hopefully) fixed it now and the script is online again.

    you need to copy the script again !

    a report is welcome

    P.S.

    what image are for RPi3b+ ?

    I guess RPi2

    Edited once, last by GDPR-7 (June 23, 2022 at 9:08 AM).

  • jim_p, I found a bug (what is for update/downgrade) wasn't work as expected

    (hopefully) fixed it now and the script is online again.

    you need to copy the script again !

    a report is welcome

    Perhaps the bug found is with the RPI box I guess ?

    Anyway v 0.06 tested on NUC all works fine (downgrade / Upgrade)

    PS :

    your script with tool "putty" for automate connecting and launch all command is magic for me. So quick and simple.

    Thanks again :)

  • I think something is wrong here :P

    Code
    your Platform is:        Generic-legacy.x86_64
    running nightly is from: 20220625
    and has Git Tag:         ccaf8be
    +++ nightlies currently available on the download server +++
    * for an update:        !!! No updates !!!
    * for an downgrade:     LibreELEC-Generic-legacy.x86_64-11.0-nightly-20220626-17f7264.img.gz

    I risked though and pressed d to "downgrade" to that nightly, checked that the file was copied in the .update folder, rebooted and the update was done correctly.

    p.s. Can you please use a paste service or a gist or even make github repo for the script? It's kinda annoying to copy 400+ lines every time and create a new file when you can just wget it and be ready in 1 second.

  • jim_p

    I guess the script version you were running was NOT V0.06 from 23.06.22, right ?

    I would be very very astonished, if so, cause exactly the mismatch what is the update/downgrade was/should be fixed in V0.06 and I run the script daily here without your above obvious mismatch/mistake.

    there is a internal talk going on to place the script on (in ?) a central place in the future, but before it will change again, cause the download server structure will change.

    up to that:

    no need highlight 400 lines !

    just click the copy icon most right of the word "Bash" (top of the Code box)

    the whole keystrokes with editor "vi" needed are:

    0. open a webrowser and move to comment #1 in this thread

    1. ssh to the LE box

    2. move to the directory where the elder script lies

    3. run "cat < get_nightly.sh > get_nightly.sh" what empties this file/script

    4. vi get_nightly.sh

    5. press the copy icon in comment #1; a popup message will appear

    3. press in vi the "i" key (for insert)

    4. press in vi "CRTL+SHIFT+v" what paste the content into the currently empty get_nightly.sh [press "CTRL+SHIFT+v" ONLY ONCE !!!]

    5. press in vi "ESC"-key (leaves vi's insert mode)

    6. and afterward ":wq" (double point, write, quite)


    I risked though and pressed d to "downgrade" to that nightly, checked that the file was copied in the .update folder, rebooted and the update was done correctly.

    no need to check that manually, the script already does it.

    and another point:

    if something goes wrong with the downgrade: it has nothing to do with my script, cause it's the update installer task.

    my script just fetches a nighlty image and places it under ~/.update

    that's all it does.

    or in short:

    "teamwork is essential. it allows to blame someone else." 8o

    Edited 2 times, last by GDPR-7 (June 27, 2022 at 6:15 PM).

  • Yes I am on v0.06 from 23.06.2022

    As for the script part, compare all those steps above with something like that

    Code
    rm get_nightly.sh
    wget https://gist.githubusercontent.com/pitsi/e1a47f4b9c8d0176e2c2b8fa2f8fa1da/raw/67d0a404b7b4beeafde457b10b3354b2686eca30/apt.conf -O get_nightly.sh
    chmod +x get_nighly.sh

    My gist above is for debian's apt (file /etc/apt/apt.conf), but you get the idea. Also, I use nano because I am not comfortable with vi.

    And today, besides the above message that the new image is under downgrade, I am getting a low space message

    Code
    NOT enough disk space to proceed.
    I need roughly echo 1092 MB of free disk space !

    I have backed up the image of 20220625 for another reason, but the free space I have is enough for it to download

    Code
    # df -h
    Filesystem                Size      Used Available Use% Mounted on
    ...
    /dev/sda2                 1.3G    382.7M    954.1M  29% /storage
    ...

    Its an old 2gb usb stick. I am now moving the foremention image to my pc so that the script runs properly even with the downgrade option.

    ---edit

    I forgot to mention that the upgrade and downgrade options appear properly on the rpi.

    Edited once, last by jim_p (June 28, 2022 at 6:06 AM).

  • Yes I am on v0.06 from 23.06.2022

    now, and also before your comment #46, too ?

    see my attached screenshot:

    I'm like you on "ccaf8be"

    and I test the script daily with the download server side in an browser open

    And today, besides the above message that the new image is under downgrade, ...

    and

    I forgot to mention that the upgrade and downgrade options appear properly on the rpi.

    seems to be a contradiction

    me is confused

    ... I am getting a low space message

    and

    I have backed up the image of 20220625 for another reason, but the free space I have is enough for it to download

    yup, for "download" only

    please read line 7 in comment #1

    what is it ?

    what's my doing in the script ?

    at least a sort of "blame JoeAverage"-prevention

    backgound:

    I've downloaded the Generic and a RPi image and decompressed them.

    it turned out: what you can read in line 7 from comment #1.

    the numbers 4 and 5 are rounded values, cause I only could calculate with integers.

    decompression is a point what the update installer does and I'm unsure how he/it handles this "low disk space case" exactly:

    IIRC, the update installer denies to install the update !

    so, the nightly was on one hand successfully downloaded, but on the other NOT installed cause of insufficient disk space.

    in the worst case I would have downloaded a nightly maybe (see some comments above) on a low speed internet connection *just* for peanuts !

    question: who would be the idiot afterwards ? 8)

    so my script checks the disk space needed to successfully decompress the nightly during update installer run *before* I start a download at all and exists when diskspace seems low !

    EDIT

    I've checked the decompression factors again:

    as mglae somewhere said max. decompression size is always ~576 MB (tested Generic and RPi2), what would be a decompression factor for Generic of 3 and for RPi 5

    is fixed in script Version V0.07

  • Yes, when I wrote msg 46 both installations had v0.06 of it. And yes, I am also confused about why it happens only on the generic-legacy.

    I am now upgrading them to v0.07 of the script, but due to the lack of new images (both of them are on 20220627-f7f28a7), I will post any new findings tomorrow.

  • Arrrggghhh, I completely read over (correct engl. ?) "legacy".

    sorry !!!

    - legacy is untested by me, so far -

    EDIT

    see comment #52

    P.S.

    V00.7 doesn't change anything regrading your issue you see !

    it has an adjustment [1] regarding disk space check

    [1] where I'm not complete satisfied with ...

    P.P.S.

    in case you want to avoid a disk space checks at all:

    you could change line 401 and 408 to:

    download_and_install ${UPDATE_NIGHTLY};

    and

    download_and_install ${DOWNGRADE_NIGHTLY};

    each without: "check_disk_space ... &&"

    Edited 4 times, last by GDPR-7 (June 29, 2022 at 2:34 AM).

  • so I switch to legacy and it turns out there is still a bug (an update is identified as downgrade, f*ck !)

    - needs time -

    Edited once, last by GDPR-7 (June 29, 2022 at 2:35 AM).

  • Version 0.08 is out.

    update/downgrade mismatch with Generic-legacy (see comments #46 and #52) is/should be fixed now

    tested here: Generic and Generic-legacy

    Edited once, last by GDPR-7 (June 29, 2022 at 2:41 AM).

  • Since there are no new nightlies today, because the last commit is still f7f28a7, I will keep 0.07 and test it and I will upgrade to 0.08 afterwards.