How to unzip files in a Heroku Buildpack - heroku

I'm writing a custom Heroku buildpack (heroku-buildpack-fantom) for Fantom, and as part of the compile script I've downloaded a .zip file (from a language vendor), but how do I unzip it?
unzip is not a recognised command.
gunzip exists but I can't use it to unzip .zip files.
What am I missing?

Even though (by default) Linux does not come pre-installed with unzip, the Heroku dyno does have a jar command. So the following works okay:
> jar xf wotever.zip

Be sure to run the 'file' command on it. I got a .zip file from SourceForge that was actually bzip2 encoded and Heroku has both the bunzip2 decoder and the -j (--bzip2) option on tar to handle it.

Related

Why the same zip file doesn't work in MacOS?

This is quite strange for me. I have an APP file (.app) which works on my MacOS. I want to upload it into the AWS S3 so I zip it as .app file is considered as a folder. When I download the zip file and unzip it, the app doesn't work anymore.
I even tried zipping it in terminal
zip -yr myapp.zip myapp.app
And when I download it, I also tried unzipping it in terminal
unzip myapp.zip -d myapp-folder
But that was also doesn't work. I checked the app size and they are identical. Any idea why it happens? and how can I fix it?
zip/unzip don't preserve file attributes (including extended attributes). To fix this, use ditto tool instead of zip/unzip.
The same rule for just copying files: use ditto instead of cp

How to tell rpmbuild to use extracted folder instead of archive?

I installed a sources rpm for Linux kernel on Centos. And I need to make modifications to the kernel and build it. The kernel.spec file has the line that tells rpmbuild to get the sources to build from the archive file
Source0: linux-%{rpmversion}-%{pkgrelease}.tar.xz
The archive is in the typical location: ~/rpmbuild/SOURCES/linux-%{rpmversion}-%{pkgrelease}.tar.xz
I extracted the archive in the same directory, and that is ~/rpmbuild/SOURCES/linux-%{rpmversion}-%{pkgrelease}
How to tell rpmbuild to get the sources from the extracted version which has my changes and not from the archive?
I already tried the trivial solution to just remove ".tar.xz" extension, but that did not work:
error: File /root/rpmbuild/SOURCES/linux-3.10.0-957: Is a directory

How to unpack xx.tar.z files types?

I have installed a software that unpacks .zip and .tar files. However
I was wondering how do you unpack this kind of files myxxx.tar.z?
I have Tugzip installed but cannot open such .tar.z file format.
Also how do you zip such files?
The most famous app to do this kinda stuff is the Winrar. Did you tried with it? You can try the 7zip too.
If your working on linux, you can do,
To decompress:
tar -zxvf myxxx.tar.z
To compress:
tar -czvf your-file.tar.z your-files

wget or curl to download .app file that has been zipped from github

app file that I have zipped up and pushed to a github project of mine.
Now i want to write a bash script to download this zipped file, however I can't seem wget to work.
I am doing wget
https://github.com/MyProject/myRepo/blob/master/appBuild/myApp.zip?raw=true -O /Users/myName/Desktop/myApp.zip
but I get some corrupted file
On my github repo, I have been using wget to download the main archive.
Try this for you:
wget https://github.com/MyProject/myRepo/blob/master/appBuild/myApp.zip -O /Users/myName/Desktop/myApp.zip
I simply removed the "?raw=true" from the link. I haven't used that flag before.
If you can provide me the actual link, I'd be happy to test it for you.

Error when opening .tar.gz via Shell to install Apache Maven

Machine:
Mac OSX 10.5.8 32-bit.
Goal:
To install apache maven per its websites instructions, in order to install the JUNG package according to its install instructions, so I can use the JUNG classes in various Java GUIs.
What I Did:
Downloaded a .tar.gz file, and using the shell, moved it to a directory (using mv) I created for it (using mkdir), usr/local/apache-maven per the website directions
I downloaded the file apache-maven-3.0.4-bin.tar.gz. Next I tried extracting the file using tar -zxvf apache-maven-3.0.4-bin.tar.gz.
Error:
I get an error message when I try to extract the apache-maven .gz (install?) file in shell.
tar: apache-maven-3.0.4/direcoryandfile: Cannot open: No such file or directory
...
apache-maven-3.0.4/lib/ext: Cannot mkdir: No such file or directory apache-maven-3.0.4/lib/ext/README.txt
tar: apache-maven-3.0.4/lib/ext/README.txt: Cannot open: No such file or directory tar:
Error exit delayed from previous errors
Instructions:
For the maven building
Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4... The subdirectory apache-maven-3.0.4 will be created from the archive.
...
for the JUNG installation
Appendix: How to Build JUNG
Get Maven
Download and install maven2 from maven.apache.org: http://maven.apache.org/download.html. At time of writing (early June 2012), the latest version was maven-3.0.4. Install the downloaded maven2 (there are installation instructions on the Maven website).
Follow the installation instructions and confirm a successful installation by typing 'mvn --version' in a command terminal window.
Self-Rectification Attempts
From what I can tell the archive file is missing some directories or something. I tried deleting the file, redownloading the .tar.gz file from a different mirror and repeating the process. Same result. Thanks again for the help
Background:
I'm trying to install the JUNG package to my system's Java, so I can write object-oriented code using various GUIs (Ecliplse, Dr. Java) using the classes in JUNG. I don't understand how the building/installing process works, and how I can get what I build/install to work on various GUIs and the command line. I'm new to shell and the command line, and mostly have experience using a simple IDE (DrJava, Python IDLE, R GUI) to write and compile object-oriented code.
To unpack a tar.gz archive you need to do it either in two steps:
gunzip apache-maven-3.0.4.tar.gz
tar -xf apache-maven-3.0.4.tar
or you might try to do it in a single step:
tar -zxf apache-maven-3.0.4.tar.gz
Two Step Process:
1. Extract the .tar from the .tar.gz using gunzip, and -v for having gunzip print what its doing. gunzip -v apache-maven-3.0.4.tar.gz
2. Extract the .tar file using tar, -x for telling the program to do an extraction, -v for having tar print what its doing, and -f for tar to know that the following file is the archive and appending with sudo so tar has permission to create directories. sudo tar -xvf apache-maven-3.0.4.tar

Resources