packelf/README.md

49 lines
1.6 KiB
Markdown
Raw Normal View History

2024-05-20 20:57:31 +02:00
`packelf` was inspired by [the idea of Klaus D](https://askubuntu.com/a/546305). It is used to pack a ELF program and its dependent libraries into a single executable file.
2022-10-05 04:46:42 +02:00
2024-07-07 18:10:07 +02:00
## Usage (packelf):
2022-10-05 04:46:42 +02:00
```
2024-07-07 18:10:07 +02:00
Usage: ./packelf.sh <ELF_SRC_PATH> <DST_PATH> [ADDITIONAL_LIBS]
2024-05-20 20:57:31 +02:00
```
First, pack a ELF program. For example, you can pack `ls` like this:
```
# ./packelf.sh /bin/ls /root/ls
tar: Removing leading `/' from member names
'/bin/ls' was packed to '/root/ls'
Just run '/root/ls ARGS...' to execute the command.
Or run 'PACKELF_UNPACK_DIR=xxx /root/ls' to unpack it only.
2022-10-05 04:46:42 +02:00
```
2024-05-20 20:57:31 +02:00
You can execute the packed program directly:
```
# /root/ls -lh /root/ls
-rwxr-xr-x 1 root root 1.3M May 21 08:35 /root/ls
```
2022-10-05 04:46:42 +02:00
2024-05-20 20:57:31 +02:00
However, every time the packed program is executed, an internal unpacking operation is performed automatically, which results in a slower startup of the program.
2022-10-05 04:46:42 +02:00
2024-07-07 18:10:07 +02:00
## USAGE EXTRA TOOLS:
2022-10-05 04:46:42 +02:00
2024-07-07 18:10:07 +02:00
```
Usage: ./packelf-copylibs.sh <ELF_SRC_PATH> <PATH_TO_COPY_LIBRARIES>
2022-10-05 04:46:42 +02:00
```
2024-05-20 20:57:31 +02:00
2024-07-07 18:10:07 +02:00
```
Usage: ./packelf-folder.sh <FOLDER> <FILENAME> <EXECUTABLE_RUN>
2022-10-05 04:46:42 +02:00
```
2024-07-07 18:10:07 +02:00
## Dependencies
2024-05-20 20:57:31 +02:00
* sh
* tar
2024-05-21 18:42:28 +02:00
* sed
* grep
* chmod
* readlink
* ldd (only needed for packing, not needed for executing or unpacking)
2024-05-20 20:57:31 +02:00
Note: If your tar doesn't support gzip, '-n' is needed when you pack a program.