You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koreader/platform
Martín Fernández 699ee3efc1
[Android] Migrate user directories after update (#6287)
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
```
4 years ago
..
android [Android] Migrate user directories after update (#6287) 4 years ago
appimage [CI] Add curly braces check (#5809) 4 years ago
cervantes Unbreak OTA on crappy shells (#5850) 4 years ago
common Unbreak OTA on crappy shells (#5850) 4 years ago
debian [Desktop] Fix missing glyphs by packaging freefonts again (#6218) 4 years ago
kindle Don't exit KUAL on the Voyage (#6233) 4 years ago
kobo More robust way to detect our own path on Kobo (#6283) 4 years ago
pocketbook [CI] Add curly braces check (#5809) 4 years ago
remarkable Don't bypass fbdepth when starting KOReader @ 8bpp (#5841) 4 years ago
sony-prstux PRSTUX: wifi/suspend fixes 4 years ago
ubuntu-touch [CI] Add curly braces check (#5809) 4 years ago
win32 move platform dependent files into 'platform' directory 10 years ago