Skip to content

Unbreak OTA on Kindle#5758

Merged
NiLuJe merged 11 commits intokoreader:masterfrom
NiLuJe:master
Jan 11, 2020
Merged

Unbreak OTA on Kindle#5758
NiLuJe merged 11 commits intokoreader:masterfrom
NiLuJe:master

Conversation

@NiLuJe
Copy link
Copy Markdown
Member

@NiLuJe NiLuJe commented Jan 10, 2020

Regression since #5715 (because I forgot to test with tarballs, and links be weird).

Also, pile on yet another stupid Kindle workaround to make sure an OTA update won't break the launcher script itself because of truncation, which would break the exit sequence, leaving the user with an apparently hung device, simply because the WM was never unpaused...

Yay Kindle. -_-"

Fix #5721


This change is Reviewable

Because vfat. And pain. And misery. And blood & tears.
Crappy workaround to make sure OTA updates will finally behave on
Kindle...
@NiLuJe NiLuJe requested a review from Frenzie as a code owner January 10, 2020 18:03
(Make shellcheck happy. Because it's right, quotes are the bomb).
@NiLuJe NiLuJe modified the milestone: 2020.01 Jan 10, 2020
@NiLuJe
Copy link
Copy Markdown
Member Author

NiLuJe commented Jan 10, 2020

(Wasn't technically broken (well, more broken than usual :D) in the previous stable, so not putting this in a milestone).

(Although the OTA workaround is new, and should be a neat QoL fix).

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Jan 10, 2020

(Wasn't technically broken (well, more broken than usual :D) in the previous stable, so not putting this in a milestone).

I'm not sure if that quite makes sense. I see it more as things that are part of it, in any case.

Copy link
Copy Markdown
Member

@Frenzie Frenzie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, added a potential nitpick

# the file, see koreader#1644.
cd $(INSTALL_DIR) && \
tar -I"gzip --rsyncable" -cah --no-recursion -f ../$(KINDLE_PACKAGE_OTA) \
tar --hard-dereference -I"gzip --rsyncable" -cah --no-recursion -f ../$(KINDLE_PACKAGE_OTA) \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically only for Kindle?

(I'm fine keeping it the same everywhere for simplicity; just asking.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, although I figured this couldn't hurt, since most of those will be deployed on vfat anyway, and all of them were already using --dereference (h).

# living in a magical land that doesn't suffer from gross filesystem deficiencies.
# Otherwise, the vfat+fuse mess means an OTA update will break the script on exit,
# and potentially leave the user in a broken state, with the WM still paused...
if [ "$(dirname "${0}")" != "/var/tmp" ]; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need to be preserved on reboot?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a tmpfs, so it'll go poof on reboot.

I'm fine with leaving however kb this takes when we exit, it's 32MB by default, we've got more than enough space in there ;).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, since it's no longer on a crappy FS, it also wouldn't hurt to unlink on exit, now that I think about it ;).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will? Hmm… odd.

https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s15.html

5.15. /var/tmp : Temporary files preserved between system reboots
5.15.1. Purpose

The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, I guess I mean that /var/tmp seems needlessly longer than /tmp if there's no special reason to prefer /var/tmp

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the Kindle plugged in for details, but /var is a tmpfs on Kindle, and /tmp is either not one at all, or another, much smaller one, and that one might be noexec in some setups.

So, yeah, /var/tmp should be a safer bet than /tmp, on Kindle at least ;).

(FWIW, both /tmp and /var/tmp are tmpfs on my desktop ^^).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TL;DR being: That was a concerted decision after checking the state of /tmp vs. /var/tmp on various Kindle generations ;).

Make sure we always use our own (as on legacy devices, people may not
have a recent copy anywhere else, if at all), AND make sure it won't
bork an OTA update...
@Hzj-jie
Copy link
Copy Markdown
Contributor

Hzj-jie commented Jan 10, 2020

Interesting, on my voyage, /var is tmpfs, no /tmp entry. E.g. it's rootfs?

@NiLuJe
Copy link
Copy Markdown
Member Author

NiLuJe commented Jan 11, 2020

Quite possibly, yeah (so, double trouble: not a tmpfs, and, worst of all, ro :D).

@NiLuJe NiLuJe merged commit 72fd93c into koreader:master Jan 11, 2020
mwoz123 pushed a commit to mwoz123/koreader that referenced this pull request Mar 29, 2020
* Deref hardlinks in tarballs
* Ensure an OTA won't break the launcher script, which'd screw the user on exit.
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.

Cannot be relaunched after update

3 participants