freeman groups wrote:

I've been attempting to move to a cd-based setup and have been getting into partial backups as a consequence. I've noticed some unexpected behaviour (bugs?) and would like to bring my observations to the attention of the Bering/uClibc team.

I began by wanting to do a partial backup of the etc package. However the proposed partial-backup package created was very small (~ 350 bytes). I took a look at it's contents and it includes the stuff beneath /var/lib/lrpkg but nothing from within /etc. Note that the etc.lrp has no etc.local file so the default 'partial' handling takes place where the package's files beneath /etc and /var/lib/lrpkg should be included.

The etc.list 'include file' for the etc.lrp package is simply:
    etc
    var/lib/lrpkg/etc.*

I then looked at the script - /usr/sbin/lrcfg.back.script and line 50 (the culprit, I believe) says:
sed -n -e \\:etc/:p -e \\:${LRPKG#/}:p $PKGLIST >$INCLUDE


and AFAICT it's only keeping components from beneath
etc/
... which means that it doesn't affirm the line in etc.list that says
etc
since there's no trailing backslash (where this absence of a trailing backslash is the proper syntax, AFAICT).


I 'fixed' the problem (to the limited extent of my understanding of regexpr) by using:
sed -n -e \\:\^etc\$:p -e \\:etc/:p -e \\:${LRPKG#/}:p $PKGLIST >$INCLUDE
i.e. by adding the part:
-e \\:\^etc\$:p


which AFAICT means that a line that contains only 'etc' will meet the criteria and thus a partial backup of etc.lrp will be complete.

I checked this out and it seems to work as I was expecting.

The correct way to fix this is with an etc.local file:

  # cat /var/lib/lrpkg/etc.local
  + cat /var/lib/lrpkg/etc.local
  I etc
  I var/lib/lrpkg/etc.*

Of course, you could also add a spec *JUST* for the etc.list file as you did above. I added an etc.local file in Dachstein rather than something like your additional sed matching pattern. I think the etc.local file just got lost in the process of making bering-uClibc, as not many folks tend to do partial backups (although it's a great way to upgrade your LRP files...even if I'm installing on a HDD or flash, I make two partitions, one for 'stock' LRP files and the other for partial backups of config data. Then upgrading is (usually) simply a matter of updating the stock package and rebooting).

BTW maybe I can ask: should not all the sed matches on line 50 there have the \^ criteria (match starting at the beginning of the line) within, so that matches must be relative to the root directory, as opposed to accepting any directory which includes "etc/"? AFAICT a folder of /getc/somedir would (erroneously?) meet the criteria of
-e \\:etc/:p

Hmm...you could be right. I don't remember enough of the details of the backup scripts to know off the top of my head if adding a ^ to the match pattern would break anything.


? Then again I don't quite fathom the syntax of the sed commands on LEAF as they seem to be somewhat different than the norm. Anyone have a good link for understanding this sed's syntax that might help educate me?

See the info pages for sed, and closely read through the shell escaping rules. I think your confusion comes from the combination of shell escapes hiding some slightly arcane sed syntax most folks don't seem to be familiar with. To dissect your above addition:


\\:\^etc\$:p

is interpreted by the shell and converted to:

\:^etc$:p

...which is then parsed by sed

I'll assume you're familiar with the 'p' (print) command for sed, and the fact that you can use addresses with most sed commands (ie: /matching-text/p ). The escaped colon tells sed to use the colon character as an address seperater, rather than the default backslash.

In other words,
/match-text/p

is the same as
\:match-text:p

except if you use something other than the backslash, you can then use backslashes freely in your address pattern, ie:
\:/path/to/my/file/:p


This is just like the ability to choose a seperator for substitutions (ie: s:/old/path1:/new/path2:), except since sed doesn't automatically know you're including an address at the start of the command (whereas it does know a substitute command is followed by two patterns and optional flags), you have to escape the new seperator or sed will try to interpret it as a command.

--
Charles Steinkuehler
[EMAIL PROTECTED]


------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND ------------------------------------------------------------------------ leaf-user mailing list: [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/leaf-user SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to