I've played a bit with #6275, to make the iterator available for non-power users too.
this PR automate user data migration (which happens once per update). If the folder `koreader/scripts.afterupdate` contains a file `migrate` then files will be copied to internal dir preserving their relative path. Thus user data **needs** to have the same hierarchy as internal directories.
Shell scripts will be find and run if the folder `koreader/scripts.afterupdate` exists and has no `migrate file`.
In the case of `koreader/scripts.always` there's no migration available, just shell scripts.
Digging a bit seems not possible to create new directories on app internal storage (it just crashes on the emulator since API25). So very fancy extensions are not supported, but it is ok to override files and create new files if dir already exists.
Tested with:
```find scripts.afterupdate/
scripts.afterupdate/
scripts.afterupdate/data
scripts.afterupdate/data/hyph
scripts.afterupdate/data/hyph/Roman.pattern
scripts.afterupdate/data/example.css
scripts.afterupdate/migrate
```
Results:
```
06-20 16:16:33.590 3584 3597 I KOReader: after-update: running migration
06-20 16:16:33.596 3584 3597 I KOReader: command cp /storage/emulated/0/koreader/scripts.afterupdate/data/hyph/Roman.pattern /data/user/0/org.koreader.launcher/files/data/hyph/Roman.pattern returned 0
06-20 16:16:33.600 3584 3597 I KOReader: command cp /storage/emulated/0/koreader/scripts.afterupdate/data/example.css /data/user/0/org.koreader.launcher/files/data/example.css returned 0
06-20 16:16:33.604 3584 3597 I KOReader: command rm /data/user/0/org.koreader.launcher/files/afterupdate.marker returned 0
```
* More robust way to detect our own path on Kobo
Should take care of all the weird and interesting ways people manage to
find to break it...
NOTE: "$(dirname $(realpath "${0}"))" works, too, but I'm not sure if
really old devices ship with the realpath applet...
* Abort early if KOREADER_DIR is null
Add the possibility to run *.sh scripts:
After an update of koreader all *.sh scripts in /sdcard/koreader/scripts.afterupdate
are executed.
On every start of koreader run all *.sh scripts in /sdcard/koreader/scripts.always
Requires koreader/android-luajit-launcher#233
Requires koreader/koreader-base#1117
It is a workaround for #6263 but can be useful on some devices with erratic back key behaviour too (yep, Onyx)
This apparently fatally upsets the WM on FW >= 5.12.4
I don't have the HW to test it, and I've been saying FW 5.12.x is evil
from the get go, so, eh.
Re #6117
* Simplify env siphoning some more
* Nope, shellcheck, quoting this breaks it.
(it preserves the LNs instead of abusing them as free field separators with word splitting).
And, while this does break on env vars with spaces (since they'll be
unquoted), that was already the case of the xargs approach.
If we had read -d & printf %q, we could go with a pure shell approach,
but we don't ;).
* Document a working quoted variant.
For science!
* Kindle FL shenanigans
Either fix#5986, or break a whole crapload of weird corner-cases.
Possibly the insane AutoFrontLight checks.
* Make fl step 0 usable on devices where 0 doesn't turn the light off.
By fudging an extra step on our own side.
* Also, add some debug logging around wmctrl to try to figure out what's
happening there...
* Unbreak OTA on crappy shells
Very, very old ash versions abort on set -o failures (as mandated by
POSIX, granted). This makes it impossible to reliably catch failures in
a single step.
So do it from the Lua side instead.
Should fix#5844
* Launch the zsync wrapper through bash on Cervantes
* [Kobo/reMarkable] Don't skip fbdepth when launching KOReader @ 8bpp
I'm not quite sure how that can happen unless you really want to, but
apparently it did on @Frenzie's H2O ;p
* Also remove the temporary files when doing a full retry
* Bump base
Pickup the required zsync2/FBInk updates
(https://github.com/koreader/koreader-base/pull/1038)
* Actually does what it says on the tin for Abort
i.e., cleanup temporary files
* remarkable: remove unnecessary screen invalidate on resume
This is handled in uimanager if needsScreenRefreshAfterResume is enabled
(which is the default).
* remarkable: pass a path argument to reader.lua
Otherwise if lastfile is not set in the settings (e.g. install and then
exit without opening a file) koreader will just refuse to start.
* remarkable: pass koreader.sh args (if any) through to reader.lua
Touchscreen is mirrored in X & Y and has a different resolution from the eink panel.
Uses systemd for time/date/suspend/poweroff/reboot
Two systemd units for platform integration. button-listen is a very
simple launcher.
to-do: add support for wifi by implementing a wpa supplicant dbus client.
Authored-by: Thomas Spurden <tcrs@users.noreply.github.com>
Update shellcheck and shfmt to the latest version.
Fixes <https://github.com/koreader/koreader/issues/5152>.
Btw, you can apply shellcheck suggestions with a command like:
```
shellcheck --include=SC2250 -f diff *.sh | git apply
```
* Prefer our own FBInk binary
* Get rid of the CRe config tweaks
* Oops, actually ship libkohelper in the KUAL extension.
* Bump extension version
* Flush to disk before printing final status message
* Restart KOReader after a crash, after showing a fancy crash recap screen (our very own Gray Screen of Death!).
Kobo only, because it's possibly the platform where getting booted out
of KOReader is the most annoying.
Keeps track of crashes, to be able to give up after a while, in order to
avoid boot loops in the unlikely event of a crash loop on startup.
Adds a dev option to *always* exit KOReader after the crash screen.
Although the current hard-coded paths work on debian, they may fail on many other distros. Other distros may pack koreader based on the released deb file. I personally have problem using current script on nixos, as it does not use the paths `/bin/bash` and `/usr/lib/`.
* Try to make sure restoreWifiAsync eventually sends a NetworkConnected
event...
re: #5109
* Take a page from @shermp's book, and make sure wpa_supplicant managed to
connect to the AP before acquiring an IP.
Tear down WiFi modules in case of failure.
c.f., https://github.com/shermp/Kobo-UNCaGED/pull/21
* Don't let restore-wifi-async.sh enable WiFi behind our back when we're
killing it to start Nickel...
* Don't even call ping if there's no default gw
add support for runtime permissions on api23+
add support for devices with a notch on api28+
fix some potential memory leaks
do not check luajit-launcher shell scripts
* Add a toggle to disable the C blitter in the Dev menu (depends on https://github.com/koreader/koreader-base/pull/882) (never shown if the JIT is disabled, grayed out if the C blitter is not installed)
* Fix a few sizeUtf8Text call sites that were doing a nil check in order to account for the new return type.
* Tweak statusbar handling to avoid spurious sizeUtf8Text warnings when it's hidden, and unify its behavior between being hidden via toggle, and hidden on book open (at least when all-at-once is not enabled).
* c.f., https://github.com/koreader/koreader-base/pull/882 (Android, PB, RGB32 & Legacy Kindle regression fixes).
* Enforce Portrait rotation on the Forma *everywhere*, KSM included.
KSM is currently emulating a bogus rotation, which causes issues with
FBInk, but also happens to be insidiously quirky in weird corner-cases.
* The Great 8bpp Experiment
Swap to 8bpp on Kobo, because we're 'effing grayscale, for pete's sake!
* Always swap to 8bpp, no matter the launch method.
Because it turned out that, even when restarting Nickel, we had to
restore the expected bitdepth ourselves, because pickel/Nickel didn't do
the job completely.
(I'm going to guess the grayscale flag wasn't getting flipped properly).
* Dither every non-transparent icon to the eInk palette
* Make sure hasBGRFrameBuffer is only enabled when the Kobo fb actually is
@ 32bpp...
* Re-process badly grayscaled icons
* And re-grayscale that one w/ gamma correction so the squares show up
better.
* Allow the fbdepth switch to be disabled (in Developer settings).
Also, allow setting debug mode that way.
Also, forcibly disable verbose logging when disabling debug.
* Update setting name to piggyback on the existing check in reader.lua
* Update icons postprocessing info
Includes "set android versionCode and android versionName at buildtime" (<https://github.com/koreader/android-luajit-launcher/pull/106>)
* versionCode uses the number of Git commits, because Google doesn't like values larger than `2100000000`
* versionName uses our existing version string
References #2040.
* On zsync delta failure, offer to retry OTA update with a full download
Fix#4429
* Bring the "this may take a while" popup back up before full DL
Don't rebuild the local tarball for a full dl, we're ignoring it anyway
;)
Co-Authored-By: NiLuJe <ninuje@gmail.com>
* Enforce a known rotation on startup, to make sure we handle touch input coordinates properly.
* Proper FrontLight warmth support (thanks to @cairnsh & @pazos in #4291)!
* Fix the PageTurn buttons mapping to match Nickel's defaults
* Properly remap PageTurn buttons depending on the current rotation.
* Actually enable the Mk.7 screen refresh codepath on *all* Mk.7 devices (I'd messed up the device check...).
* Full accelerometer handling (includes a touch of refactoring regarding orientation handling in general).
* Fix insidiously broken USBMS behavior in Nickel after we exit on FW >4.8.
Fix#4291Fix#3002
It's generally broken, and useless there.
The main intended use-case is the DX/DXg, because of its larger screen &
low RAM leading to more severe memory constraints.
* remove unused setting 'internal_storage_mount_point
use filemanagerutil.getDefaultDir() instead
https://github.com/koreader/koreader/blob/master/frontend/apps/filemanager/filemanagerutil.lua#L15
* more info about device frontlight/naturalLight capabilities
* make stock reader fonts available in KOReader
* remove restore-wifi-async leftovers
* wireless: fix wpa_supplicant configuration:
make it compatible w/ debian wheezy binaries
don't try to run enable-wifi.sh more than once
* Only switch to ondemand when we actually can, and when it's better than the current governor...
This potentially leaves Mk.5 in the lurch, but there's no perfect solution there :/.
* Switch to UI for the unmark event of navigation hints markers
Might help on non-REAGL devices, and doesn't hurt there (re #3983).
* Switch SQLite DBs to WAL
Sounds nice in theory, behaves fine in practice.
* Switch to ondemand CPUFreq governor on Kobo
My H2O boots with the userspace (!!) governor...
Note that the hardware appears to blissfully ignore any of this, because
the stats still show the CPU changing state on its own...
* Handle OTA updates during the restart loop on Kobo/Kindle
So we can actually process OTA updates without ever truly exiting
KOReader (i.e., via the "Restart KOReader" menu entry) ;).
* With a bonus version normalizer fix.
* And a zsync bump/fix to avoid softlocks with OpenStack HTTP frontends (also, pull those from the OTA mirror list).
* Better KOA2 support
* Fix FL
* Add physical pageturn keys
* Add accelerometer support
* Possibly better NaturalLight handling on the Clara
* Fix WiFi module name used in some(?) Mk7 Kobos
* A bunch of kodev fixes
* Link to the WiKi, it's a bit more explainy ;).
* More WiFi trickery for some HW revs
* Fix Rev2 detection under KSM
That's to future-proof it, the other end of this hasn't made it into
current KSM build yet.
* Resync nickel.sh w/ current rcS
We don't have CPU, but we have PLATFORM, which is based on CPU, so,
that'll do :).
* Go back to using rmmod instead of modprobe -r
Functionally identical on current FW, will potentially avoid getting
outsmarted by modprobe if Kobo ever deigns shipping an actually usable
Linux system one day...
* Don't crash if screensavers directory doesn't exist
c.f., https://www.mobileread.com/forums/showpost.php?p=3706979&postcount=2919
* Switch all initial highlights to "fast" update
i.e., everything that does an invert
Plus a few other things that refresh small UI elements onTap
Re #3130
* Tweak refreshtype for a number of widgets:
* Fix iconbutton dimen
* Make touchmenu flash on close & initial menu popup. Full-screen on close.
* Use flashing updates when opening/closing dictionary popup. Full-screen on close.
* Switch FileManager to partial.
It's mostly text, and we want flash promotion there.
* Make configdialog & menu flash on exit
* Make FLWidget flash on close
* virtualkeyboard: flash on layout change & popup.
* Potentially not that great workaround to ensure we actually see the
highlights in the FM's chevrons
* Flash when closing BookStatus Widget
* Optimize away a quirk of the dual "fast" update in touchmenu
* Promote updates to flashing slightly more agressively.
* Document what each refreshtype actually does.
With a few guidelines on their optimal usecases.
* Switch remaining scheduleIn(0.0) to nextTick()
* Tighter scheduling timers
Shaving a hundred ms off UI callbacks...
* Cache FFI C Library namespace
* Ask MuPDF to convert pixmaps to BGR on Kobo
Fix#3949
* Mention koxtoolchain in the README
re #3972
* Kindle: Handle *all* fonts via EXT_FONT_DIR instead of bind mounts insanity
* Make black flashes in UI elements user-configurable
(All or nothing).
* Jot down some random KOA2 sysfs path
* Refresh Kindle model ID routines
* Pickup current OTA packages
We stopped shipping files w/ the full .tar.gz extension a looooong time
ago.
* And actually generally handle current packages properly
* Kindle screensaver handling experiment
WIP, because there's a fair bit of insanity left in there.
Namely, USBMS is anathema. We simply shouldn't do that, at all,
but the system allows us to do it and basically shoot ourselves in the
head one way or another.
* Don't try to handle the insanity that would be USBMS on Kindles
* Yay, one less thing to worry about :).
* Okay, that should be much saner...
Since the whole deal w/ letting the WM handle stuff was for SO, restrict
that to SO devices.
The other concern was USBMS, but we can't support it.
* Reword that
* And move that comment inside the branch, like its counterpart
* Trim unneeded stuff from startup script
I was somehow convinced I'd already done that...
While we're there, explain why we need to siphon those specific vars
* Fix a stray eth0
-> $INTERFACE
* Be very very sure we have INTERFACE set in our env
re #3936
* Make getFirmwareVersion less fragile on Kobo
Not that we actually use it right now, but, still. :D
* Use the same syntax as the PRODUCT check
* Actually implement getProductId
Instead of a stray c/p ^^
* Properly identify the Rev2/Mark7 variants of existing devices
Namely, the H2O² and Aura SE
Not that the H2O²r2 support is still broken, this just allows us to
implement it cleanyl without breaking handling of the original H2O²
re #3925
* Tweak sleeps a bit around Kobo WiFi modules...
See if that jog things up (re #3936)
* Try harder not to suspend with WiFi on on Kobos
Because otherwise, things go boom. (re #3936)
Regression after bdb82d09c1
TL;DR: That thing is race-y as hell.
The more I play with Kobos, the more it feels like the whole thing's
held together by pieces of fraying strings...
* Flag those scripts as executable in git
Somewhat irrelevant because we'll end up living on a FAT32 drive, but,
still.
* Cleanup Kobo startup script
Support KFMon >= 0.9.5
Don't siphon PRODUCT from nickel, it's exported by rcS, so fmon/KFMon
already inherit it.
Siphon NICKEL_HOME, on the off-chance nickel fails to figure that one
out for itself on restart.
Siphon LANG (This may be a terrible idea, rcS sets LANG to en_US.UTF-8,
while we set LC_ALL to en_US.UTF-8, but I don't know if nickel itself
ever updates LANG, since I have mine set to en_US also ;)).
My secret hope if that everything's working as it should and this ensures
we default to Nickel's locale on fresh installs?
Remove the extra sync on startup, both @Baskerville's fmon and KFMon are
smart enough not to do anything overly stupid, and recent FW versions
have a slightly more resilient DB anyway (rollback journal -> WAL).
This effectively shaves over a second off our startup time.
* Slimmed down the nickel restart script.
Based on current rcS
Scrapped a bucketload of irrelevant & legacy crap, since we're never
bootstrapping nickel, only restarting it.
* Update Kobo install instrcutions.
Point to KSM09, @Baskerville's fmon, and KFMon.
Deprecate legacy fmon, and as such, stop shipping a useless KoboRoot
tarball.
You'll still have to call it with `ANDROID_ARCH=x86 ./kodev build/release/run android`.
Don't forget to `./mk-luajit.sh clean` in luajit-launcher when changing architectures.
* Bump android-luajit-launcher
This includes the fix for Android 8. Fixes#3126.
* Bump base
Also improve SDK installation for ease of setting up development system.
This also puts in place most of the missing pieces to finish the intent in #3064.