tar xf foo -- how to restore symlink?
Gary Aitken
freebsd at dreamchaser.org
Sat Apr 21 02:34:58 UTC 2018
On 04/20/18 07:24, Lowell Gilbert wrote:
> Gary Aitken <freebsd at 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
More information about the freebsd-questions
mailing list