I didn't find anything like that on the internet, but eventually came across the memfd_create system call, which creates an anonymous file in RAM than can be executed just like any file on a disk.
There is one downside, though - this syscall was added in kernel 3.17 and it's both build-time (kernel headers) and run-time requirement.
This tool can be used to create e.g. all-in-one, portable collection of favourite binaries (preferably statically linked and UPXed), but also scripts and other resources, like docs, images, etc.
Quick start:
0. Download the attached tarball and extract it
1. Make sure you have devx.sfs loaded
2. Put all binaries, scripts and other stuff in applets directory
3. Run ./toolbox.sh
(More info and a few examples of cross-compiling can be found in README file.)
This will create a multi-call binary named, by default, toolbox:
Code: Select all
# ./toolbox
Usage:
./toolbox <applet> [arguments] execute an applet
./toolbox -l|--list list available applets
./toolbox -d|--dump <applet> dump an applet to stdout
./toolbox -v|--version show version info
./toolbox -h|--help this very help
#
Just like with BusyBox, you can also create symlinks pointing to that binary:
Code: Select all
./toolbox -l | tr '\n' '\0' | xargs -0 -n1 ln -s toolbox
There's also an option dump an applet to stdout, which may be desired in case of text files and maybe scripts, but for binary files stdout should be redirected to a file:
Code: Select all
./toolbox -d some_app > some_app
Have fun &
Greetings!