View Single Post
Old 08-07-2022, 05:30 PM   #41
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by CyberPaul View Post
Hi,
I'm trying to create a kobopatch.yaml file but I don't understand how to replace customizable strings like in this example:

I need to specify Italian wikipedia url, how can I do it within the kobopatch.yaml file? It looks like overrides works only for enabling/disabling...
Let me try to explain the usefulness of kobopatch.yaml using your custom Wikipedia patch as an example.
  1. Create a new empty file libnickel_custom.yaml (filename can be anything you like) in the src subdirectory.
  2. Copy your custom libnickel Wikipedia patch into this file with a new name e.g.
    Code:
    Change Wikipedia search language - CyberPaul:
      - Enabled: no
      - Description: |
          The patch set the search language in Wikipedia.
          Replace the "en" (in both the replace_string lines) to language code you want.
          For example English is "en" (set as default), for German is "de", for Russian is "ru".
      - FindReplaceString:
          Find:    "\0https://%1.m.wikipedia.org/wiki/Special:Search\0"
          Replace: "\0https://it.m.wikipedia.org/wiki/Special:Search\0"
      - FindReplaceString:
          Find:    "\0https://%1.wikipedia.org/wiki/Special:Search\0"
          Replace: "\0https://it.wikipedia.org/wiki/Special:Search\0"
  3. Now change your kobopatch.yaml file - see the red bits:
    Code:
    ... blah blah ...
    
    patches:
      src/libnickel.so.1.0.0.yaml:  usr/local/Kobo/libnickel.so.1.0.0
      src/libnickel_custom.yaml:    usr/local/Kobo/libnickel.so.1.0.0
    
    ... blah blah ...
    
    overrides:
      src/libnickel.so.1.0.0.yaml:
        My 24 line spacing values: yes
        Custom font sizes: yes
        Set KePub hyphenation: yes
        Always show confirmation dialog before upgrading: yes
        Unify font sizes: yes
      src/libnickel_custom.yaml:
        Change Wikipedia search language - CyberPaul: yes
    
    ... blah blah ...
The benefit of moving your custom patches into a separate libnickel_custom.yaml is that you can keep it from firmware to firmware. It's most useful for custom patches which rarely need to be changed, i.e. those which do not contain hex offsets.

When a new fw is released you can then update the main libnickel.so.1.0.0.yaml file with the new version without worrying about your custom values being overwritten. The only change you'll need to make to kobopatch.yaml is the 2 lines at the top containing fw version number.

... and, just in case you were wondering, you can also use the same approach for custom nickel.yaml patches. Very few nickel patches contain hex offsets, so can often survive, unchanged, for many firmware releases. Some of mine haven't changed for years.

Last edited by jackie_w; 08-07-2022 at 05:33 PM.
jackie_w is offline   Reply With Quote