Re: tar up a symbolic linked directory
On Sun, May 03, 2009 at 11:23:33PM -, Cameron Hutchison wrote: Douglas A. Tutty dtu...@vianet.ca writes: On Sat, May 02, 2009 at 09:04:38PM +, T o n g wrote: I want to tar up a symbolic linked directory as if it is a real directory. Is there any easy way to do it? Let me explain with an example (that you can try): mkdir d1 touch d1/{a,b,c} ln -s c d1/d ln -s d1 d2 I want that the result tar file looks like this: tar -tvzf d2.tgz drwxrwx--x tong/tong 0 2009-05-01 09:38 d2/ -rw-rw tong/tong 0 2009-05-01 09:37 d2/a -rw-rw tong/tong 0 2009-05-01 09:37 d2/b -rw-rw tong/tong 0 2009-05-01 09:37 d2/c lrwxrwxrwx tong/tong 0 2009-05-01 09:38 d2/d - c Any easy way to do it? add -h to the tar parameters. It dereferences the symbolic lyinks. However, then you won't get the d2/d - c reference. I can't see that it would be possible to dereference the top-level symlink but no others. No commands that I know of support selective symlink dereferencing, except find(1) with -H. That lead me to try: $ find -H d2 | cpio -o -L -H ustar d2.tar This comes close, storing d2/d as a link, but as a hardlink, not a symlink. Before we get too far down the garden path, would you review the why of this? It may be simpler to do it in a couple of steps. Tar up those you want with the dereferencing, telling tar to ignore those you want without dereferencing, then do a second tar run without dereferencing, telling tar to ignore those you did with dereferencing, appending it to the first tarball. Doug. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Re: tar up a symbolic linked directory
On Mon, 04 May 2009 13:48:07 -0400, Douglas A. Tutty wrote: I want to tar up a symbolic linked directory as if it is a real directory. Is there any easy way to do it? Let me explain with an example (that you can try). . . I can't see that it would be possible to dereference the top-level symlink but no others. No commands that I know of support selective symlink dereferencing, except find(1) with -H. That lead me to try: $ find -H d2 | cpio -o -L -H ustar d2.tar This comes close, storing d2/d as a link, but as a hardlink, not a symlink. Thanks. seems that this is the best approach so far. Before we get too far down the garden path, would you review the why of this? Simple -- I want to maintain an identical working environment across all places, in my prime home environment, or on remote sites, on Live CDs or their HD installations. The most important thing about the identical is logical identical, as oppose to physical. I.e., I expect a certain path name to be at a specific location, across all environments that I work in, despite the fact that such path name might be a symlink one to other folder on another volume with another name. It may be simpler to do it in a couple of steps. . . Thanks, but that still seems too complicated to me. So I'll propose to tar developers for my seems-legitimate request, to, either differentiate d2 and d2/ as sync does, or add a option similar to find -H. Thanks for the comments. -- Tong (remove underscore(s) to reply) http://xpt.sourceforge.net/techdocs/ http://xpt.sourceforge.net/tools/ -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Re: tar up a symbolic linked directory
On Sat, May 02, 2009 at 09:04:38PM +, T o n g wrote: Hi, I want to tar up a symbolic linked directory as if it is a real directory. Is there any easy way to do it? Let me explain with an example (that you can try): mkdir d1 touch d1/{a,b,c} ln -s c d1/d ln -s d1 d2 I want that the result tar file looks like this: tar -tvzf d2.tgz drwxrwx--x tong/tong 0 2009-05-01 09:38 d2/ -rw-rw tong/tong 0 2009-05-01 09:37 d2/a -rw-rw tong/tong 0 2009-05-01 09:37 d2/b -rw-rw tong/tong 0 2009-05-01 09:37 d2/c lrwxrwxrwx tong/tong 0 2009-05-01 09:38 d2/d - c Any easy way to do it? add -h to the tar parameters. It dereferences the symbolic lyinks. However, then you won't get the d2/d - c reference. Doug. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Re: tar up a symbolic linked directory
Douglas A. Tutty dtu...@vianet.ca writes: On Sat, May 02, 2009 at 09:04:38PM +, T o n g wrote: Hi, I want to tar up a symbolic linked directory as if it is a real directory. Is there any easy way to do it? Let me explain with an example (that you can try): mkdir d1 touch d1/{a,b,c} ln -s c d1/d ln -s d1 d2 I want that the result tar file looks like this: tar -tvzf d2.tgz drwxrwx--x tong/tong 0 2009-05-01 09:38 d2/ -rw-rw tong/tong 0 2009-05-01 09:37 d2/a -rw-rw tong/tong 0 2009-05-01 09:37 d2/b -rw-rw tong/tong 0 2009-05-01 09:37 d2/c lrwxrwxrwx tong/tong 0 2009-05-01 09:38 d2/d - c Any easy way to do it? add -h to the tar parameters. It dereferences the symbolic lyinks. However, then you won't get the d2/d - c reference. I can't see that it would be possible to dereference the top-level symlink but no others. No commands that I know of support selective symlink dereferencing, except find(1) with -H. That lead me to try: $ find -H d2 | cpio -o -L -H ustar d2.tar This comes close, storing d2/d as a link, but as a hardlink, not a symlink. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org