Re: tar and gunzip help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



At Fri, 21 Aug 2009 12:16:41 -0700 CentOS mailing list <centos@xxxxxxxxxx> wrote:

> 
> HI All,
> 
> I have a directory tree that when the user un-gzips/untars it does  
> into /opt by default.
> 
> The directory tree is like:
> 
> ugui
> |
> |-- <misc files>
> |-- source
> |-----framework
> |------ <misc files>
> 
> so when unzipped I want to end it with /opt/ugui and all the stuff  
> below it.
> 
> How do I do this? Can I also issue one command that will unzip and  
> untar the archive at the same time? (I know I can, I just cant get it  
> right)

Assuming you did:

tar czvf ugui-package.tar.gz ugui

Then you would do:

tar xzvf ugui-package.tar.gz -C /opt

The 'z' option implies piping the output (c) or input (x or t) though
gzip. Using 'j' instead of 'z' implies bzip2 instead.

The -C option implies a cd to the directoriy specified.

I don't believe tar itself can have an absolute directory embedded.  GNU
Tar *always* strips off a leading '/' in archives (but see the -P
option).

Just using tar, I don't think you can *force* a user to unpack under a
specific directory tree.  You might want to consider using the rpm
system, which can in fact enforce where a package is unpacked into.

> 
> Thanks!
> -ML
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
> 
>                     

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Download the Model Railroad System
http://www.deepsoft.com/  -- Binaries for Linux and MS-Windows
heller@xxxxxxxxxxxx       -- http://www.deepsoft.com/ModelRailroadSystem/
                                                                                                                              
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux