I try to download a tar.gz file and uncompress it on /tmp/apps.
However i don't want to uncompress it if the directory already exists.
If the file exists or even doesn't exist it is downloaded and uncompressed.
I cant find my code is missing a parameters on my exec block or if I made a mistake somewhere else.
I'm using Puppet 3.8.
Gist file of my puppet
Use the puppet/archive module, https://forge.puppet.com/puppet/archive. It will download the archive, check for existing files and even tidy up after itself.
Related
Is it possible to tell ebuild inside the .ebuild file that the SRC_URI file actually points to a file on the filesystem instead of a website? I tried putting in just the raw pathname but it tried to connect to some website and download the package instead of look locally. I tried with file:// prefix too and it didn't work. Is this even possible or nah? Will I have to actually publish the .tgz file somewhere so that portage can download it?
I want to extract a ZIP File with the .exe inside.
I want to execute the .exe inside the Zip to extract the Zip File.
Already tried it by executing: ZipDLL::extractall "$EXEDIR" "$DESTINATION"
I think that does not work, cause the .exe is stored in the TEMP Folder when opened, so it cannot find the.Zip file
So how do I extract that Zip when executing the .exe from inside the Zip?
Thanks for answers!
Your question does not make a lot of sense, you should just put the files inside the installer and not have a zip file at all.
Even if it made sense, it is not possible because where a exe is executed from when you double click it inside a zip file depends on the zip program you are using and there is no way of getting the path of the zip it was extracted from.
If for some reason you want to be able to update the files inside the zip file without rebuilding the installer you can use a cab file instead. The CabX plug-in supports extracting from cab files appended to the installer exe.
I was copying a folder from a Debian computer (university specific distro) to a Windows computer. I used tar to make a gunzipped tarball containing the folder. I transferred the file using MobaXterm, which used SFTP. I accidentally removed the original file, but I still had the tarball, so I used that to restore.
However, when I looked back in the directory to edit the file heatmap_get.py (which was marked executable), it was a bunch of unreadable information. When I tried to execute the script, it stated:
-bash: ./heatmap_gen.py: cannot execute binary file
I have tried executing strings on the file, but it is not helpful. This tarball contained multiple files, but this was the only one that was effected. I really need this file; any help is appreciated.
Update:
If I copied heatmap_gen.py to heatmap_gen.tar.gz, and undid the tarball, it yielded an exact copy of the directory it was in except it did not have the heatmap_gen.py file.
It looks like the original tarball was not archived correctly as pointed out by l'L'l. It appears that the tarball contained a copy of itself within the file heatmap_gen.py.
I need to get the content of archives and then I want to uncompress the selected one - but I dont want to uncompress the archives to know what's in it. I'd like to list and uncompress at least zip and rar, but (if that's possible) I don't want to be limited to only these two.
Can you advise good npm modules or other projects to achieve this?
Here's what I came up with:
zip
I found node-zip can only unzip files, but not list archive content.
rar
The best solution seems node-rar, but I can't install it on Windows.
node-uncompress This does what it says: It's an "Command-line wrapper for uncompressing various file types." So there is again no possibility to list archive content.
Currently I try to get node-uncompress to list files and hopefully it must never run cross-platform.
Solution:
I am now using 7zip with the node module node-7z instead of trying to get every archive working on its own. The corresponding site is: https://www.npmjs.com/package/node-7z
This library uses the OS independent archive manager 7zip. On Windows 7za is used. "7za.exe (a = alone) is a standalone version of 7-Zip". I've tested it on Windows and Ubuntu and it works great.
Update:
At Windows: Somehow I just got it working by adding 7za to the Path variables - not by adding 7za.exe to the "the same directory of your package.json file." like the description says.
Update 2:
On Windows 7za, that's referred in the node-7z post, cannot handle .rar-archives. So I'm using the "casual" 7-zip instead of 7za.exe. I just renamed the commanline 7z.exe to 7za.exe and added the 7-zip folder to the Path Variables.
I have downloaded snort rules from the website but instead of getting a zipped folder, I get a single file which cannot be opened by windows. I also tried using 7zip to extract the file regardless its a single file but it just replicates itself.
anyone know how I can resolve this or a get snort rules zipped folder?
It's a gunzipped tar ball (tar.gz) (reference). You need to unzip it first, you can use 7-zip on windows just right click on it then > 7-zip > Open Archive. The archive will have a .tar file (community-rules.tar) just right click on this and hit Open. This should create a folder "community-rules" with a few files inside. The rules file is the one called "community.rules", all of the rules are in this file. If you open it with wordpad you should be able to see all of the rules.
If you're on linux/unix/mac you can just run the command:
tar xzvf community-rules.tar.gz