Le samedi 12 septembre à 22:31, Dan McGhee a écrit : > This is not a problem with building LFS. I'm asking for help in the way > I want to do it. > > I'm preparing for another build and over the years I have developed some > scripts to take care of the sometimes "drudge work" of "configure, make, > make install." With each build my script(s) get a little more > sophisticated (?). This time, I want to enter a package name; e.g., > autoconf-2.64.tar.bz2, and, from that name, make a log directory > (autoconf-2.64-logs), give the source tree and variable name > (packagedir=autoconf-2.64), "untar" the archive and enter the source > tree directory ($packagedir). This will be the first function in a > script that then configures, compiles and installs the package. > > The problem I'm having is this. Some packages are *.tar.gz and others > are *.tar.bz2. I thought it would be easy to test for this and then > invoke tar with the appropriate command line parametes, but I can't get > it to work.
I think that "cut" and "rev" should help you ; something like rev $PACKAGENAME | cut -d '.' -f1 | rev to obtain the suffix telling you if the file was compressed whith gzip or bzip2. -------------- Ph. Delavalade -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
