I've been thinking about a way to deploy configurations on a linux system, Specifically dotfiles.
I would really like to somehow compile all the dotfiles into one executable that, when executed, deploys them in the right place. Here comes the tricky part: the files are not available on the system where the executable is to be executed and I only want to 'ship' the executable. Nothing else.
Is there a way to put the files into the executable, so that they can be safely extracted later?
(I'm trying to build this in Haskell, but any language will do for the POC.))
Executable files contain binary machine code that has been compiled from source code. This low-level code instructs a computer's central processing unit on how to run a program. The processor interprets the machine code and tells the computer's hardware what to do.
Yes, there's plenty of space in an executable image you can put data. You can add a pre-initialised data segment for this, say, and write the data into there; or a resource, or you can abuse some of the segment padding space to store values in.
A program file that can be run by a computer or device. An executable file contains a set of instructions, which your device interprets and runs when you open that file. For example, when you open the Microsoft Word executable file, it launches the Microsoft Word application.
An executable is a file that contains a program - that is, a particular kind of file that is capable of being executed or run as a program in the computer. In a Disk Operating System or Windows operating system, an executable file usually has a file name extension of . bat, .com, or .exe.
You can do this using Template Haskell. Check out the file-embed package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With