Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Apr 2018 20:34:14 -0600
From:      Gary Aitken <freebsd@dreamchaser.org>
To:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: tar xf foo -- how to restore symlink?
Message-ID:  <039392da-f614-fc89-bd5a-d70e88ad4706@dreamchaser.org>
In-Reply-To: <44sh7qvwly.fsf@be-well.ilk.org>
References:  <5ff313cf-6148-be90-0195-7d21f1f836ac@dreamchaser.org> <20180418063005.056e321d.freebsd@edvax.de> <9902b54d-4684-6ba6-a08b-f3d9504c1273@dreamchaser.org> <20180419160503.38e1aa75.freebsd@edvax.de> <9e435ffd-8997-74c7-9502-854a004ac5cc@dreamchaser.org> <44sh7qvwly.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/20/18 07:24, Lowell Gilbert wrote:
> Gary Aitken <freebsd@dreamchaser.org> writes:
> 
>> Unfortunately, I'm not in control of generating the archive or the 
>> way it's fetched.  It's fetched via the ports system.  I'm going
>> to punt on the project for now as I've got a better alternative.
> 
> Sounds like you aren't aware that our cpio(1) can extract tar files.

Not anymore :-)  Thanks.
It's still not clear to me it would help.
Polytropon's comment indicated using cpio to create the file being
transferred, and I don't have control of that; or at least I don't
think I do.

In terms of extracting from the given tar file, are you suggesting
cpio can do the following in a general manner:

Tarball:
drwxrwxr-x  0 ml     ml          0 May 26  2017 nufraw-0.41/doc/
-rw-rw-r--  0 ml     ml       6195 May 26  2017 nufraw-0.41/doc/ChangeLog
lrwxrwxrwx  0 ml     ml          0 May 26  2017 nufraw-0.41/doc-pak -> doc/
-rw-rw-r--  0 ml     ml       6195 May 26  2017 nufraw-0.41/doc-pak/ChangeLog

restore doc-pak as a symlink
ignore the entry doc-pak/ChangeLog

I've tried cpio -i
              creates top level directory only
            cpio -id
              doc-pak not restored as a symlink; hierarchies duplicated
            cpio -id -f doc-pak/[a-z,A-Z]*
              gets the symlink properly
              requires detailed knowledge of the file hierarchy
            cpio -id --insecure
              "Can't replace existing directory with non-directory"
              duplicate hierarchies, no symlink
            cpio -idu
              "Can't replace existing directory with non-directory"
              duplicate hierarchies, no symlink

Gary



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?039392da-f614-fc89-bd5a-d70e88ad4706>