Ant的tar任务即使在其他平台上使用该任务也可以设置Linux文件权限吗? [英] Can Ant's tar task set a Linux file permission even when the task is used on other platforms?

查看:36
本文介绍了Ant的tar任务即使在其他平台上使用该任务也可以设置Linux文件权限吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 Ant 1.7 开始,TarFileSet 可用,它似乎允许在 tar 存档中修改文件权限.

Starting with Ant 1.7, the TarFileSet is available which seems to allow file permission modifications in the tar archive.

此功能是否与平台无关,以便我可以例如在 Windows 上创建一个 tar 文件并为此存档中的脚本文件设置执行权限,如果文件在 Linux 上解压缩,则该文件将具有此标志?

Does this feature work platform-independent, so that I can for example create a tar file on Windows and set execution permissions for script files in this archive which will have this flag if the file is unpacked on Linux?

推荐答案

是的,您可以使用 tarfileset,使用 filemodedirmode 属性.这适用于创建 tar 存档,即使在 Windows 上也是如此.

Yes, you can set permissions using tarfileset, using the filemode and dirmode attributes. This works when creating tar archives, even on windows.

尽管很烦人,解压任务没有 支持您可能想要的反向操作:

Rather annoyingly though, the untar task does not support the reverse operation that you might want:

文件权限不会恢复关于提取的文件.

File permissions will not be restored on extracted files.

但是,例如,如果您使用 tar -xf,权限会恢复正常.

But the permisions are restored fine if you use tar -xf, for example.

这篇关于Ant的tar任务即使在其他平台上使用该任务也可以设置Linux文件权限吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆