07-17-2007, 03:39 PM | #1 |
Addicted to Porting
Posts: 1,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
|
My First SED Script (modifying er_registry)
Soon (hopefully), everyone will be able to reflash their iLiad. This means that shell scripts that modify the internal configuration won't be dangerous. To that effect, adding new viewers to the registry will be useful.
I've started playing with SED in order to add new viewers to the registry. I've tested this on my PC, but I forgot my iLiad at home. It seems to work pretty well. Does anyone have any comments, suggestions, etc, for my scripts? This is literally the first exposure I've had to sed, so it may look a bit ugly. run.sh Code:
#!/bin/sh export scriptdir=`/usr/bin/dirname $0` cd $scriptdir cp /mnt/settings/er_registry.txt /mnt/settings/er_registry.txt.orig sed -i -f update.sed /mnt/settings/er_registry.txt Code:
s\uaIDList=\uaIDList=FBREADER;\g /uaIDList=/ { a\ [FBREADER]\ category=viewer\ arguments=<FILENAME>\ exec=/usr/local/programs/FBReader/fbreader.sh\ xResourceName=sh\ channel=14\ extensions=chm;CHM;fb2;FB2;rtf;RTF;tcr;TCR;oeb;OEB } /EXTENSION_INFO/ { a\ chm=/usr/share/contentlister/Icon_books.png\ CHM=/usr/share/contentlister/Icon_books.png\ rtf=/usr/share/contentlister/Icon_books.png\ RTF=/usr/share/contentlister/Icon_books.png\ fb2=/usr/share/contentlister/Icon_books.png\ FB2=/usr/share/contentlister/Icon_books.png\ tcr=/usr/share/contentlister/Icon_books.png\ TCR=/usr/share/contentlister/Icon_books.png\ oeb=/usr/share/contentlister/Icon_books.png\ OEB=/usr/share/contentlister/Icon_books.png } |
07-19-2007, 07:54 AM | #2 |
Addicted to Porting
Posts: 1,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
|
So I tried running this script on my iLiad with the busybox sed. It gave me the output: "sed: bad format in substitution expression"
However, I compiled the GNU version of Sed, ran that on the iLiad, and it did the replacement without a problem. I can distribute the gnu sed with the package, but I'd like to know why busybox doesn't like my sed script. Any ideas? |
Advert | |
|
07-19-2007, 10:18 AM | #3 | |
Evangelist
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
|
Quote:
Just put the first command like this: Code:
s:aIDList=:aIDList=FBREADER;:g Happy sed'ing P.S.: I'm a big fan of sed -- it's a really useful command (and usually available, unlike awk or even perl ). P.S.2: Not bad for your first exposure to sed :-o |
|
07-19-2007, 10:33 AM | #4 | |
Evangelist
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
|
Quote:
For that the easiest way is to first "unsinstall" the script changes (just in case it has been run before), and only then do the changes. Examples: For deleting and then re-adding the uaIDList part: s/\(uaIDList=.*\)FBREADER;\(.*\)/\1\2/g;s/\(uaIDList=\)/\1FBREADER/g For deleting the chunk: /^\[FBREADER\]/,/extensions=chm;CHM;fb2;FB2;rtf;RTF;tcr;TCR;oeb;OEB/d Last edited by Antartica; 07-19-2007 at 10:35 AM. Reason: Clarification |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Modifying column display | ccayer | Calibre | 11 | 05-11-2010 06:18 AM |
iLiad Modifying flipbar behavior | DesiLinguist | iRex Developer's Corner | 28 | 03-10-2010 02:26 PM |
Help modifying LRFTools | Demented | LRF | 0 | 08-30-2009 02:03 PM |
Modifying Headsets | iggypop | Lounge | 0 | 03-05-2007 05:31 PM |
iLiad How to modify /etc/er_registry.txt in style | scotty1024 | iRex Developer's Corner | 5 | 11-08-2006 07:01 PM |