I created a simple tool to install patches for Kobo. I get this idea from yoq.
Advantages:
- Really simple to use, no sed or regular expressions
- Safe: code is robust and "infinite reboots" are prevented
- You can easily patch files, that is better than overwrite them:
- firmware upgrades can't be messed up
- patches done by other users are not removed
- you can do single or multiline patches
- auto-backup of patched files
- Patches survive after firmware update (but not hard-resets), so you don't need to reinstall your modifications after a firmware upgrade
The Installer has also an optional and rudimentary package manager: it prevents installation of older Kobo modifications if a newer version is already installed.
Read here for further informations.
If you want to use it for your mod, you've simply to:
- suggest users to install the Kobo Installer, or merge the content of this package with the source code of your project
- add to your project a /installer.d/ folder and write a script into it. The script must be an ".sh" or a ".py" script. This script will be invoked every time at boot. You can invoke kobo_patch.py from this script. Usage:
PHP Code:
kobo_patch.py append PROGNAME FILEPATH CODE
kobo_patch.py add-after PROGNAME FILEPATH SEARCH_STRING CODE
kobo_patch.py add-before PROGNAME FILEPATH SEARCH_STRING CODE
"append" action appends CODE at the end of FILEPATH.
With "add-after" and "add-before", CODE is added after or before SEARCH_STRING in FILEPATH.
FILEPATH will be backed up to FILEPATH_before_PROGNAME before any change will be applied. No patch will be performed if FILEPATH is already patched.
If, and only if, kobo_patch.py will succesfully patch at least one file, system will be rebooted.
IMPORTANT NOTE: failed scripts are removed from the device, so get a copy.
The package contains also Python 3 interpreter and some of its modules. Here is
the entire py3 Standard Library, pyc compiled.