replacing a file in a zip from command line
I'm using zip and unzip to set parameters on the fly in some java war files.
I can use the following: unzip -p archive.war WEB-INF/web.xml | sed -e 's/ConfigFileLocation/helloworld/g' | zip -r archive.war - The unzip works 100% The sed works 100% but... The zip adds the edit to the file as a file called '-' Using anything but '-' as the final parameter to zip gives the following: zip error: Nothing to do! Any ideas? Davee P.S. A war file is a correctly formatted zip file, by the way. :-) |
I don't think you need the -r flag. It means recursive and you're not recursing a directory structure. The man page gives the example:
Code:
tar cf - . | zip backup - Code:
zip archive.war - |
Hi Gilead,
Thanks for that - I thought the same; but -r means 'replace' (-R is resursive). Without the -r I get the same error: zip error: Nothing to do! (archive.war) The only time I don't seem to get this error is wth 'zip -r archive.war -', which, as I say creates a file in the image called '-' Any other ideas? This is really bugging me now- I can't believe unzip can work on the fly but zip cannot... |
I think we're using different zip programs then. From the man zip page on my system:
Code:
-r Travel the directory structure recursively; for example: I haven't tried it again, but it may be that you have to create the file (and the path to it?) and then replace the file in the archive with that. Having the path preserved complicates it slightly more than a flat archive would - but you can't get away from that structure with the .war file. Sorry I couldn't solve it. |
All times are GMT -5. The time now is 08:01 AM. |