Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i store unix permissions in a zip file (built with apache ant)?

Tags:

java

linux

zip

I'm building a linux installer for a Java application, and I end up with an install.jar and a setup.sh that I put in a zip file using ant.

The idea is the user unzips the zip file and then runs setup.sh but the trouble is that they always need to chmod setup.sh first to give themselves execute permissions.

I want to remove this step and Im not sure if the problem part is:

  1. That Im building on Windows
  2. That Im building with ant zip task
  3. Or that zips cannot presreve permissions and will always unzip without x permissions.
like image 473
Paul Taylor Avatar asked Nov 29 '12 19:11

Paul Taylor


People also ask

Does zip keep file permissions?

The zip file format stores the permissions of the files and folders as they were set on the system where the zip file was created.

What does zip do in Unix?

zip is used to compress the files to reduce file size and also used as file package utility. zip is available in many operating systems like unix, linux, windows etc. If you have a limited bandwidth between two servers and want to transfer the files faster, then zip the files and transfer.

Does gzip preserve file permissions?

gzip normally preserves the mode and modification timestamp of a file when compressing or decompressing. If you have appropriate privileges, it also preserves the file's owner and group. The gzip file format is specified in P.


1 Answers

You don't have to switch to tar files. I don't know why people who don't know Ant are offering advice on this topic.

Use zipfileset's filemode parameter. Documented at http://ant.apache.org/manual/Types/zipfileset.html

like image 138
Blaine Avatar answered Sep 27 '22 23:09

Blaine