Extracting patch.tar.bz2s

Chris F.A. Johnson c.f.a.johnson at home.com
Thu Mar 29 09:04:49 PST 2001


On Wed, 28 Mar 2001, Daniel Gryniewicz wrote:

> The patches (at least in 2.4) weren't tar'd, just g or b zipped.  Inside,
> they are just one patch file.  So, of course tar would complain.
>
> Daniel
> > Hi,
> > I am probably  missing something obvious. Everytime I try to extract the
> > patch files for various programs, I get a message saying that the archive is
> > garbage. I have tried bzcat "filename" | tar xv and tar xIvpf "filename"
> > Thanks,
> > Mandi

The following script (which I call unpack) takes care of most archive
formats automatically:

#!/bin/sh
# Fri Jan  5 14:57:59 EST 2001
# /usr/local/bin/unpack
# Copyright 2001, Chris F.A. Johnson
# Released under the terms of the GNU General Public License

for file in "$@"
do
    case $file in

	*.zip)
	    unzip $file
	    ;;

	*.tar)
	    tar xvpf $file
	    ;;

	*.tgz|*tar.gz|*.tar.Z)
	    tar xvzpf $file
	    ;;

	*tar.bz2|*.tbz2)
## Requires a patch to GNU tar:
## http://packages.linuxfromscratch.org/common-packages/gnutarpatch.txt.bz2
	    tar xvypf $file
	    ;;

	## gzipped and bzip2ed files are uncompressed to the current
	## directory, leaving the original files in place
	*.gz)
	    gunzip -c $file > `basename $file .gz`
	    ;;

	*.Z)
	    gunzip -c $file > `basename $file .Z`
	    ;;

	*.bz2)
	    bunzip2  -c $file > `basename $file .bz2`
	    ;;
    esac
done

# TODO:
#       Allow unpacking to a directory specified as the last argument
#	on the command line


-- 
	Chris F.A. Johnson	    bq933 at torfree.net
	=================================================================
	c.f.a.johnson at home.com	    http://cfaj.freeshell.org
	cfaj at freeshell.org	    http://members.home.net/c.f.a.johnson


-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message




More information about the lfs-dev mailing list