On 5/27/06, George Boudreau <[EMAIL PROTECTED]> wrote:
I suggested to Greg Schafer, a few years ago, that you could extract
the package directory name by 'listing the contents' and trimming the
top entry. I believe he ended up with the cmd DIR=$(bunzip2 -dc $1 |
tar tf - | head -n 1 ) and then he stripped $DIR . Would this be helpful?
I thought you guys already had that. You have to be a little careful
with that command because the first line is not necessarily a
directory and could be prefixed with ./. Here's the code that I
ripped off from Ryan Oliver's scripts:
PKG_DIR=$( tar -t${ZM} -f ${ARCHIVE} | head -n1 \
| sed -e '[EMAIL PROTECTED]/@@' -e 's@/.*$@@' || : )
The sed just strips down the path to surely get a directory name. I
can't recall why I had to add the || : at the end. I was getting
strange errors at some point. It might not be needed. ZM is just z
or j or nothing depending on the suffix of ARCHIVE.
--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page