>Message: 7 >Date: Thu, 07 Feb 2002 19:32:40 -0600 >From: "Michael D. Schleif" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >Organization: mds resource >To: LEAF-dev <[EMAIL PROTECTED]> >Subject: [Leaf-devel] Preferred package/filesystem location ??? > >Is there some kind of standard whereby, when building a new LEAF >package, we know *where* particular files belong? > [snip] > >If there isn't a standard, there *SHOULD BE* -- no? > >What do you think? >
busybox tar uses (usually GNU's) fnmatch with FNM_PATHNAME | FNM_LEADING_DIR flags and the exclusion list as a PATTERN, not a node name. This tar uses the exclusion list in a peculiar way for relative paths by matching the tail end of the file name (that is etc/modules matches boot/etc/modules). Fortunately, all LEAF backups are done relative to root and all package lists are concatenated in a single list. It is easy to force relative paths for everything on both sides (inclusion and exclusion lists) and therefore ensure a proper comparison. This takes into account Charles partial backup lists where files from a package are excluded for a partial backup and included for a full backup. We are left with two cases: 1) the user is doing a backup for some other package than yours and your package .list has an entry that reads some/dir without trailing / or /*. busybox tar will not back up anything from some/dir regardless how the other package is speced. 2) the user is doing a backup for your package and you are at the mercy of evil.lrp :-) such is life. The small diff below applies to every package including the initial RAM disk and then processes the RAM disk separately. This later idea is from Jacques Nilo's Bering code and works very well also. If you don't process the RAM disk separately, then you must use ctar which normalize node names relative to /. Dachstein 1.02 always uses ctar, for example. Bering beta 3 uses ctar for everything and busybox tar to extract to the RAM disk. ctar is an optional package in Oxygen 1.8. Unfortunately, busybox tar is used if ctar is not installed and node names are not normalized before being passed to busybox tar: You will get strange results if some other package has a filename that matches the end of one of yours. Also, when ctar is not installed, you will also destroy root.lrp because nothing will match ./* and the resulting tgz file will contain all of your filesystem. I think the need for the standard you are seeking becomes less urgent once you enumerate explicitly the files in your package and you enumerate explicitly the directories that you claim for this package. The rest belongs to the backup code. YMMV. I no longer uses ctar and make sure everything I specify is as explicit as possible. Dropping ctar changes the way the backup is done for the initial RAM disk if using LRP kernel patches. Regards, Serge Caron ___BEGIN DIFF__________ diff -urN before/lrcfg.back.script sbin/lrcfg.back.script --- before/lrcfg.back.script Fri Jan 25 11:02:22 2002 +++ sbin/lrcfg.back.script Wed Feb 6 10:40:16 2002 @@ -4,6 +4,7 @@ #Linux Router Project # # Seriously hacked by Charles Steinkuehler +# Mildly hacked by Serge Caron (Feb 2002): ctar is gone... if [ $# -lt 3 ]; then echo "Bad call to $(basename $0)" @@ -24,6 +25,12 @@ EXCLUDE="/tmp/EXCLUDE" INITRD="`sed 's/.*initrd=//;s/.lrp.*//' /proc/cmdline`" +# Force relative paths for every node in the list +filter () { +sed -e "s/^[[:space:]]*//g" -e "s/[[:space:]]*$//g" \ + -e "/^[^./]/s/^./.\/&/1" -e "/^[/]/s/^./.&/1" $1 +} + mk_inc_part () { if [ -r $LOCAL ] ; then sed -n '/^[iI]/{ @@ -79,11 +86,18 @@ mv $PKGSAVE $PKGLIST >/dev/null 2>&1 echo -n "Creating $PACKAGE.lrp Please wait: " +# busybox tar uses fnmatch with FNM_PATHNAME | FNM_LEADING_DIR flags +# and the exclusion list as a PATTERN, not a node name. +# Therefore, a package can take exclusive control of a directory +# by specifying only the node name in the package list. +# This is probably OK for everything except /etc :-) +# so I force a trailing / to make sure that only dir names match. +filter $EXCLUDE | sed -e "s/^[.][\/]etc$/&\//1" > ${EXCLUDE}.tmp + ticker cd / - #tar cf - -T $INCLUDE -X $EXCLUDE| gzip >$DIR/$PACKAGE.lrp - ctar `cat $INCLUDE` -X `cat $EXCLUDE` | gzip >$DIR/$PACKAGE.lrp + tar -c -X ${EXCLUDE}.tmp `filter $INCLUDE` | gzip >$DIR/$PACKAGE.lrp [ $PACKAGE = $INITRD ] && /usr/sbin/lrcfg.back.initrd $DIR $PACKAGE >/dev/null 2>&1 @@ -92,6 +106,7 @@ rm $INCLUDE rm $EXCLUDE +rm ${EXCLUDE}.tmp if [ "$WTMP" = "ON" ]; then ___END DIFF____________ _______________________________________________ Leaf-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/leaf-devel