Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 03-26-2008, 07:00 AM   #1
Martijn
Connoisseur
Martijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-books
 
Martijn's Avatar
 
Posts: 68
Karma: 855
Join Date: Jan 2007
Location: Netherlands
Device: iLiad
Registry modifications

What is the best way to modify the registry?
So far, I've seen manual modification, which is not very useful for non-technical people.
And I've seen shell scripts that use sed, which is not easy to undo during an uninstall.

So, I've been thinking (just of the top of my head):
What if we add a /mnt/settings/registry/applications and a /mnt/settings/registry/extensions directory, have our programs install partial XML files in there and then use another program, say update-registry, to merge those files into the registry?
This would simplify both installing and uninstalling, since a package that has to update the registry just needs to contain a few extra files and call the update-registry program in its post-install and post-removal scripts.

The update-registry program could just be a very simple shell script that cats a header, the files in those directories and a footer together to form the registry.xml file.
The drawback is that this would not be compatible with programs that modify the registry.xml file directly (like the standard iLiad software), since those modifications will not affect the header/footer files.
But I guess a more complex update-registry program could handle that.

Is this just a silly idea? Is there a better way? What do you think?
Martijn is offline   Reply With Quote
Old 03-26-2008, 07:43 AM   #2
daudi
Addict
daudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-books
 
Posts: 281
Karma: 904
Join Date: Oct 2007
Location: Newcastle upon Tyne, UK
Device: iRex iLiad, Psion 5MX, nokia n800
I think this is a very good idea. I was thinking of offering a script solution for the dejavu install requested recently, but then got worried about breaking things especially if the user wanted to uninstall so I decided not to do it. A framework like this makes a lot of sense to me.
daudi is offline   Reply With Quote
Advert
Old 03-26-2008, 09:05 AM   #3
Adam B.
Addicted to Porting
Adam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the rough
 
Adam B.'s Avatar
 
Posts: 1,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
The problem is that the registry has a specific structure, and is constantly updated by the contentlister for recent documents, settings, etc.

I think your idea has potential, but It'll still be a lot of work... update-registry would have tear apart the existing registry file to:
  • Export the settings as one file
  • Export each application registry entry as a specific file and possibly somehow split up the file association (so users can decide what programs open up what)
  • Export the file icon associations as individual files

I'm not saying it's impossible, but I think it'd be better if iRex could code some kind of extensions directory into the contentlister that would be parsed whenever it starts, so that no modifications to the registry would be needed.
Adam B. is offline   Reply With Quote
Old 03-26-2008, 09:51 AM   #4
Martijn
Connoisseur
Martijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-books
 
Martijn's Avatar
 
Posts: 68
Karma: 855
Join Date: Jan 2007
Location: Netherlands
Device: iLiad
Yeah, uninstall was also a problem for me. The djvu viewer now does not have an automatic install. I could write one, but it would simple replace the registry with a backup from before the djvu install.
(Which is OK in most cases, but would break things if the registry got changed in the meantime).

I agree that support from iRex would be ideal, but I guess that would take until the next firmware update, and I'm excited about developing for the iLiad now

Concerning the updating of the registry: The script can get the line numbers of the lines containing with <applications> and </applications>, snip everything between those lines and replace it with what's in the /mnt/settings/registry/applications directory.
And similarly for the extensionInfos section.
That way any changes to other parts of the registry are unaffected.

Furthermore, on first install of the update-registry package these sections of the registry.xml can be exported to a /mnt/settings/registry/applications and /mnt/settings/registry/extensionInfos directory to ensure that earlier settings from those sections are saved.

The drawback here is that any direct changes to the applications or extensionInfos sections of the registry.xml file after installation of the update-registry package would be overwritten on every execution of update-registry.

Splitting the sections into individual entries for each applications and file extension would indeed be nice.
On one hand I think I would leave that for a later version, on the other hand I've always been a fan of designing things right the first time around.
Martijn is offline   Reply With Quote
Old 03-27-2008, 05:48 AM   #5
Martijn
Connoisseur
Martijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-books
 
Martijn's Avatar
 
Posts: 68
Karma: 855
Join Date: Jan 2007
Location: Netherlands
Device: iLiad
I found out that libxml2 is installed on the iLiad, so maybe we could use that to do some more sophisticated updating of the registry.

I also found some scripts in /usr/bin with the encouraging titles merge_registry_parts.awk, registry_convert_ini_xml.awk, registry_merge_xml.awk, registry_updates.sh.
I have no idea what they do yet, but I'll look into it.

EDIT: Hmmm, while I'm at it I might as wel use liberregxml, that seems to be the library that iRex uses to access the registry.

Last edited by Martijn; 03-27-2008 at 06:33 AM.
Martijn is offline   Reply With Quote
Advert
Old 03-27-2008, 07:23 AM   #6
daudi
Addict
daudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-books
 
Posts: 281
Karma: 904
Join Date: Oct 2007
Location: Newcastle upon Tyne, UK
Device: iRex iLiad, Psion 5MX, nokia n800
If you want to stick to scripts and firends I once found xmlparse.awk but never got around to playing with it. Perhaps it would help?
daudi is offline   Reply With Quote
Old 03-27-2008, 10:49 AM   #7
Adam B.
Addicted to Porting
Adam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the rough
 
Adam B.'s Avatar
 
Posts: 1,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
I looked through the strings in liberregxml, but it doesn't seem like there's anything in there about adding or removing registry parts. It's mostly about updating sections of the registry and is likely called by the settings program...

However this could be useful:

Code:
root@ereader:/usr/bin# awk -f merge_registry_parts.awk 
Usage: awk -v REGISTRY_NEW=registry_new \
           -v delete_sections=sectionlist \
           -v update_sections=sectionlist \
           -v tweak_sections=sectionlist \
           -f merge_registry_parts.awk registry_old registry_template

    registry_new      = registry after update
    delete_sections   = semicolon separated list of registry sections, see more as below
    update_sections   = semicolon separated list of registry sections, see more as below
    tweak_sections    = semicolon separated list of registry sections, see more as below
    registry_old      = registry before update
    registry_template = registry template

Merge algorithm for registry sections:
    1. delete_sections sections are excluded from registry_new
    2. update_sections sections are copied from registry_template to registry_new
    3. tweak_sections sections in registry_old and registry_template are tweaked together to registry_new
    4. other sections present in registry_old are copied to registry_new
    5. other sections not present in registry_old are copied from registry_template to registry_new
I believe this script is used when updating to new firmware versions.
Adam B. is offline   Reply With Quote
Old 03-27-2008, 06:37 PM   #8
Martijn
Connoisseur
Martijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-booksMartijn has learned how to read e-books
 
Martijn's Avatar
 
Posts: 68
Karma: 855
Join Date: Jan 2007
Location: Netherlands
Device: iLiad
I looked at merge_registry_parts.awk. My awk is not very good, but it looks like it simply replaces anything between a certain start and end tag.
So this does not help when uninstalling an application.

I took a look at libxml2 got a small program working that parses the registry and removes the JAVADJVU application and the extensions associated with it.
It does leave an empty line in the applications section and two empty lines in the extensionsInfo sections, however.

I'll see if I can fix that, generalize it, and make it fit for packaging.
Martijn is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FBReader Registry installer for 2.11 Adam B. iRex 22 11-10-2013 01:38 PM
Augen The Book - potential owner modifications to reader rscudder More E-Book Readers 4 02-08-2011 11:12 AM
Abiword with Registry Installer Adam B. iRex 59 04-20-2010 07:44 PM
need registry cleaner software? [Locked] anni Lounge 7 01-23-2009 11:23 AM
iLiad How to remark a line in registry.xml? ericshliao iRex Developer's Corner 1 11-17-2008 09:37 AM


All times are GMT -4. The time now is 09:22 PM.


MobileRead.com is a privately owned, operated and funded community.