I'm creating an self extracting archive using unzipsfx.exe and with command:
cat unzipsfx.exe archive.zip > Installer.exe
I need to execute an exe from archive.zip after Installer.exe extracts content.
Need to do that from PHP installed on Linux.
I can use exec function from PHP but need to know what to execute.
Self-extracting archives are proper executable files, and if you're creating an .exe file, it's a Windows executable, and you can't execute it under Linux.
(If there is a way to execute it anyway [virtualization, Wine, etc.] then you need to execute the executable file itself.)
Related
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 hope to pack the nodejs(includes its installed module via npm) and javascript code to one execute file for different plateform(windows, osx, linux).
Is it possible or any solution?
Your comment welcome
From my understanding, you can't really create an executable file for multiplatforms. Each platform has it's own packaging format to make it binary executable. What you can do is to create a x.tar.gz file and expand it to your target platform. I myself haven't done it but theoretically it's possible. Here is an example (assuming you're using GNU tar for all your platforms):
To pack it, do:
tar cvzf nodeproject.tar.gz nodeproject
To expand, do
tar xvzf nodeproject.tar.gz
Working on a web site. A number of third party javascript libraries use mixed-case in their files and folders.
I am working on a windows system.
When ready to upload from my local windows XAMPP environment to my linux hosting, I use 7zip to create a zip file of my site. I use 7zip's -xr! feature to skip certain directories like my .git repository.
I FTP the resulting .zip file to my server and use the server's "unzip" function to explode it. All my files are there but they are all changed to lowercase!
This kills the website as the third party libraries that are mixed-case are no longer found.
I've tried unzip -C but that did not seem to do anything.
I also look in the archive prior to uploading and on windows, all the file name cases are preserved.
Tried using GNU32's windows tar but the --exclude function is not allowing me to skip the .git directories.
I need some help in the form of:
How to use unzip in linux such that is preserves case (googled until hairless, but no love found...)
How to use tar on windows such that it excludes particular directories
How to use something else to achieve my goal. I honestly don't care what it is... I'm downloading CYGWIN right now to see if it'll help at all. I may end up installing Linux in a virtual box just to try tar-gz from a virtual machine actually running linux but would REALLY rather avoid that hassle every time I want to pack up a pretty simple archive.
Zip works fine for packing, but unpacking is not kosher.
Use tar's --exclude-vcs option:
--exclude-vcs
exclude version control system directories
Example:
tar --exclude-vcs czf foo.tar.gz foo
or for a *.tar.bz2 archive
tar --exclude-vcs cjf foo.tar.bz2 foo
Try unzip -U file.zip; this might work if you have an old version of unzip. Otherwise, post the output of unzip -v and unzip -l file.zip.
I am writting a NSIS-script for installs of the programs and put into folder. The folder is zipped via NSIS. I want, that someone clicks once the zip-file and it will be unzipped and executed the NSIS-script into folder. But how?
Update: I explain again. NSIS has the compiler for NSIS script and Installer based on ZIP! Firstly, I write a NSIS script to install some programs in a folder. Executing the NSIS script is working! I dont want to send the folder, but I want to send only one file. So I am using the Installer based on ZIP to zip the folder. But if I click the zipped file, it will be unzipped on desktop without executing the NSIS script into folder. So I have to click the NSIS script into folder. That I dont want! I want to click only on zipped file and it will be unzipped and executed automatically the NSIS script. Clearly?
.zip files cannot execute code.
NOTE: The ZIP2EXE NSIS tool uses makensis internally, it is just a helper application that creates simple installers.
Your question is confusing, but I believe that what you want to do is create a self extracting archive that contains multiple files and run and NSIS installer contained in that archive it is unpacked.
You can do this with 7zip.
It's easiest to do this with a dos batch file. Open notepad and create "selfinstall.bat"
Add the following;
(
ECHO ;!#Install#!UTF-8!
ECHO Title="My Installer"
ECHO BeginPrompt="Do you want to run the installer?"
ECHO ExecuteFile="Setup.exe"
ECHO ;!#InstallEnd#!
) > temp.$$$
This sets up the information that the self extracter needs such as it's title (My Installer) and the name of the executable to run (Setup.exe)
Then, add the lines to create your zip file
7z a -r files.7z myfolder
where myfolder is the name of the folder that has all the files.
Now, add the installer - Make sure that the installer (Setup.exe) is in the root of the .7z file
7z a files.7z Setup.exe
Then, copy the self extracter and the 7z to a single executable file
copy /b 7z.sfx + temp.$$$ + files.7z "Install.exe"
Then delete your temp files
del files.7z
del temp.$$$
I adapted this from a script I saw here; http://www.911cd.net/forums//index.php?showtopic=18845
For more information on the .SFX modules see here; http://7zsfx.info/en/
There's also a sourceforge project for a GUI to accomplish this; http://sourceforge.net/projects/sfx-maker/
I want to create a rar SFX archive that can be executed on Windows, using Linux. Suppose I want to put in the archive the file myprog.exe and automatically execute the file when the archive is extracted.
I've created a init script (myinit.txt)
;The comment below contains SFX script commands
Path=%TEMP%
Setup=tftpd32.exe
TempMode
Silent=1
Overwrite=1
Then I created the archive with the following commands:
rar a -sfx archive.exe myprog.exe
rar c archive.exe < myinit.txt
Now if I open archive.exe with Winrar I can see my file and all the Option I set correctly. The problem is that if I try to execute the file (with double click) I get an error:
program too bit to fit in memory
I suppose the problem is that the file doesn't have the layout of a Windows executable.
Searching around I found that zip has an option -A that can be used to fix this problem. Is there a way to to that with rar?
Found the solution! The problem was clearly the sfx module. I searched in WinRAR program files in my Windows machine and found the Windows Default.SFX. I copied that file on my linux machine in the same directory in which I was creating the archive, renaming it to windows.sfx. At this point I run:
> rar a -sfxwindows.sfx archive.exe myprog.exe
> rar c archive.exe < myinit.txt
and it worked!
Just another tip: the file myinit.txt must be written using the Windows newline convention.
Only one thing is still missing: the possibility to set an icon for the archive. Windows documentation show a -iicon option that is missing in the linux doc.
That should work:
rar a -sfxdefault.sfx myexeforwindows.exe myprog.exe