You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Forrester, Tom" <To...@uk.thalesgroup.com> on 2002/04/30 11:21:38 UTC

Tar file won't extract properly within Telnet task

On windows I am using the <tar> and <gzip> tasks to archive my Web site.
I then use the <ftp> task to transfer the website.tar.gz file to a remote
Unix server.
I then use the <telnet> task to logon on to the Unix server and after change
to root etc. I unzip the file using gunzip website.tar.gz (within <telnet>),
the I use tar xvf ${remote_stage_dir}/website.tar (still within the <telnet>
task).

The problem is that the result or the tar xvf command unpacks all the files
within the subfolders of the archive, but not the top level files.
If go to the Unix server directly and use the same tar command on the same
file it unpacks all the files correctly, so the ant script is capturing all
the files in the <tar> task.

I also followed the same steps manually by using the telnet program on
windows, and that unpacked the files correctly.

I can only surmise that the <telnet> task in ant is having some effect on
the  tar xvf ${remote_stage_dir}/website.tar command. BTW,
${remote_stage_dir}/ expands properly.

If anyone has any ideas please, reply!

Below is my code:
    <target name="packageWebsite" if="website"
                                description=" creates the website gzip
file">

        <!-- Create a TAR file of the web site-->
        <tar tarfile="${dist}/website.tar" basedir="${web_site}"
 
excludes="**/_notes/**,**/Library/**,**/Masterimages/**,**/Templates/**,**/T
MP*" />

        <!-- Archive the TAR file to a GZIP file -->
        <gzip zipfile="${dist}/website.tar.gz" src="${dist}/website.tar"/>

    </target>
    
        <target name="deployWebsite" depends="packageWebsite"
                                description="Deploys the web site">
             <!-- FTP the web site to the remote server-->
            <ftp server="${remote_server_domain_map}"
                remotedir="${remote_stage_dir}"
                userid="${remote_userid}"
                password="${remote_password}"
                depends="no"
                binary="yes">
                <fileset dir="${dist}">
                    <include name="**/website.tar.gz"/>
                </fileset>
            </ftp>
    
            <!-- Deploy the web site on the remote server-->
            <telnet server="${remote_server_domain_map}">
                <read>login:</read>
                <write string="${remote_userid}" />
                <read>Password:</read>
                <write string="${remote_password}" />
                <read string="${remote_user_home}"/>
                <write>su</write>
                <read>Password:</read>
                <write>holiday</write>
                <read>#</read>
                <write>csh</write>
                <read string="${remote_user_home}"/>
                <write string="cd ${remote_stage_dir}" />
                <read string="${remote_stage_dir}"/>
                <write string="gunzip website.tar.gz" />
                <read string="${remote_stage_dir}"/>
                <!--<write string="chmod 666 ${virtual_server_path}" />
                <read string="${remote_stage_dir}"/>
                <write string="cd ${virtual_server_path}" />
                <read string="${virtual_server_path}"/>-->
                <write string="tar xvf ${remote_stage_dir}/website.tar" />
            </telnet>
    
    </target>


Thales Defence Information Systems DISCLAIMER: The information in this
message is confidential and may be legally privileged. It is intended solely
for the addressee.  Access to this message by anyone else is unauthorised.
If you are not the intended recipient, any disclosure, copying, or
distribution of the message, or any action or omission taken by you in
reliance on it, is prohibited and may be unlawful.  Please immediately
contact the sender if you have received this message in error. Thank you.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


CleanImports: 1.0.4 yet another update

Posted by Tom Brus <to...@euronet.nl>.
Hello list,

CleanImports 1.0.4: Fixed a problem with classpaths on linux.

Thanks to Tom and Nick for testing.

Tom.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tar file won't extract properly within Telnet task

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Forrester, Tom" <To...@uk.thalesgroup.com>
To: <an...@jakarta.apache.org>
Cc: <st...@iseran.com>
Sent: Tuesday, April 30, 2002 02:21
Subject: Tar file won't extract properly within Telnet task


>
> On windows I am using the <tar> and <gzip> tasks to archive my Web site.
> I then use the <ftp> task to transfer the website.tar.gz file to a remote
> Unix server.
> I then use the <telnet> task to logon on to the Unix server and after
change
> to root etc. I unzip the file using gunzip website.tar.gz (within
<telnet>),
> the I use tar xvf ${remote_stage_dir}/website.tar (still within the
<telnet>
> task).
>
> The problem is that the result or the tar xvf command unpacks all the
files
> within the subfolders of the archive, but not the top level files.
> If go to the Unix server directly and use the same tar command on the same
> file it unpacks all the files correctly, so the ant script is capturing
all
> the files in the <tar> task.

> I can only surmise that the <telnet> task in ant is having some effect on
> the  tar xvf ${remote_stage_dir}/website.tar command. BTW,
> ${remote_stage_dir}/ expands properly.

unlikely


>             <!-- Deploy the web site on the remote server-->
>             <telnet server="${remote_server_domain_map}">
>                 <read>login:</read>
>                 <write string="${remote_userid}" />
>                 <read>Password:</read>
>                 <write string="${remote_password}" />
>                 <read string="${remote_user_home}"/>
>                 <write>su</write>
>                 <read>Password:</read>
>                 <write>holiday</write>

we didnt need to know that :) ...<telnet>'s own login stuff should work

>                 <read>#</read>
>                 <write>csh</write>
>                 <read string="${remote_user_home}"/>
>                 <write string="cd ${remote_stage_dir}" />
>                 <read string="${remote_stage_dir}"/>
>                 <write string="gunzip website.tar.gz" />
>                 <read string="${remote_stage_dir}"/>
>                 <!--<write string="chmod 666 ${virtual_server_path}" />
>                 <read string="${remote_stage_dir}"/>
>                 <write string="cd ${virtual_server_path}" />
>                 <read string="${virtual_server_path}"/>-->
>                 <write string="tar xvf ${remote_stage_dir}/website.tar" />
>             </telnet>

you need to wait for the tar to finish; add another read for the prompt


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>