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) Thanks! -ML
ML 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. >I'm not sure what you are asking here. If you cd to /tmp and untar the file, what does it do?> 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) >You can unzip and untar with "tar xzf filename" with a recent version of tar. -- Bowie
On Fri, Aug 21, 2009 at 3:16 PM, ML <mailinglists at mailnewsrss.com> 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) > > Thanks! > -ML > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centosDo you mean to say that the filenames within the tar archive(s) are hard-coded all the way from "/" down? Boris.
ML 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.Gnutar will default to removing a leading / even if you include it in the archive paths unless you use the -P option during both the archive creation and extraction.> 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)The -z option will gzip during creation and ungzip during extraction. However, this operation really sounds like something that should be done by building an RPM for distribution if it is strictly an end user package or with one of the revision control packages (subversion, etc.) if multiple users will be making changes to be merged. -- Les Mikesell lesmikesell at gmail.com
At Fri, 21 Aug 2009 12:16:41 -0700 CentOS mailing list <centos at centos.org> 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 at centos.org > 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 at deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/