On 06/12/2010 12:31 PM, Burton Strauss III wrote:
> Understand the concept is not to automate everything… but I did find the
> constant checking for .tar.gz vs. .tar.bz2 annoying. So I came up with this.
>
> Place it in /home/lfs during Chapter 5 and/or in $LFS/root for use
> during chapter 6. Invoke as:
>
> . ~/prep package-archive
>
> Don’t forget the dot first (otherwise, the cd command doesn’t stick –
> you’ll find yourself doing a “huh what?” because you aren’t in the
> directory you expect). Also, if you mess up the package-archive name,
> such as forgetting the extension, you can find the exit dropping you out
> of the shell…
>
> Finally, sure you can automate more & more … but you risk breaking
> things, missing errors, etc.
>
> Enjoy!
>
>
> if [ "${1##*.}" = "gz" ]
>
> then
> ...
>
> elif [ "${1##*.}" = "bz2" ]
>
> then
>
> tar xfvj $1

All this isn't really necessary with any recent distro, as tar >=1.15 
(which anyone building LFS should have, since the Host System Reqs. now 
specify 1.18 or newer) can automatically detect compression when 
unpacking, so either bz2 or gz (or others such xz) tarballs can be 
unpacked with "tar -xf [archive]".
>
> dir=`basename $1 .tar.bz2`

This isn't really reliable, since not all packages unpack into a 
directory that exactly matches the archive name (see Vim, for example). 
A better method for scripting would be to get the directory name from 
the output of "tar tf [archive]".
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to