To me, this sounds like mission impossible, but there are people who know more than me, so i thought maybe i have a chance :)
I would like to have 1 file that would execute on both - windows and linux.
Basically, program could be made out of 2 parts.
Part 1 being the windows executable which can run on windows.
Part 2 being the linux shell script which can run on linux.
Is there a way to build the file in such a way, that linux could ignore the windows binary executable bytes and just run the shell script which is appended as text onto the binary windows executable?
I've tried to add bytes before the windows exe, and of course windows fails to recognize the file. So yeah, i can't put anything before the bytes of executable, however i CAN add them at the end of file.
Then, on linux, i took the plain script
#!/bin/bash
echo "Hello world?"
exit 0
and added some text before the script. All it did was complain about non existent command, but continued to execute the file and i got the "hello world" text outputted.
Putting those two things together (cat runLinuxPart.sh >> myMix.exe) and then chmod +x myMix.exe then run it, i get The entry point method could not be loaded :(
The linux shell file is a sort of self extractor-installer. It hold the .tar at the end and the script on the front, so if i run the .sh on linux, it gets the .tar, extracts and does all i need.
The windows exe purpose is to connect to remote linux machine, extract .sh file from itself and upload it to linux, then run it.
I want to give a single self installer file to users.
If this my dream is impossible i will of course be ok with 2 separate installers too