Bug 432797

Summary: Support self extracting Linux files.
Product: [Applications] ark Reporter: Marcos Dione <mdione>
Component: generalAssignee: Elvis Angelaccio <elvis.angelaccio>
Status: REPORTED ---    
Severity: wishlist CC: aacid, rthomsen6
Priority: NOR    
Version First Reported In: 20.08.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: bar.bin as generated in the example

Description Marcos Dione 2021-02-11 11:56:22 UTC
SUMMARY
Self extracting Linux files can be simply a bash script followed by a compressed file. I see in the suggested bug, self extracting zips are supported. Maybe we could do something similar here? I tried with one of my own, renaming it from .bin (we should support arbitrary extensions) and got this error:

ark.kerfuffle: Could not find a plugin to handle "self-extract-bash-tar-gz.tar.gz"
Comment 1 2wxsy58236r3 2021-02-12 10:32:45 UTC
Are there any developers or projects using self extracting Linux files? If so, could you please give some examples?
Comment 2 Marcos Dione 2021-02-13 18:08:55 UTC
mdione@diablo:~/tmp/foo$ mkdir bar
mdione@diablo:~/tmp/foo$ touch bar/{a,b,c}

mdione@diablo:~/tmp/foo$ sudo apt install makeself

mdione@diablo:~/tmp/foo$ echo '#! /bin/bash
echo "installed!"' > bar/install.sh
mdione@diablo:~/tmp/foo$ chmod 755 bar/install.sh

mdione@diablo:~/tmp/foo$ makeself bar bar.bin 'bar for foos' ./install.sh
Header is 666 lines long

About to compress 8 KB of data...
Adding files to archive named "bar.bin"...
./
./install.sh
./c
./a
./b
./a
./b
./c
./install.sh
CRC: 2648421794
MD5: fe39420c250a13e5efd2e708d7494a78

Self-extractable archive "bar.bin" successfully created.

mdione@diablo:~/tmp/foo$ ls -l
drwxr-xr-x 2 mdione mdione  4096 feb 13 19:05 bar
-rwxr-xr-x 1 mdione mdione 17023 feb 13 19:05 bar.bin

mdione@diablo:~/tmp/foo$ ./bar.bin
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing bar for foos  100%
installed!
Comment 3 Marcos Dione 2021-02-13 18:09:35 UTC
Created attachment 135661 [details]
bar.bin as generated in the example
Comment 4 Marcos Dione 2021-02-13 18:12:27 UTC
At work we use the same principle, but by hand (go figure). The gist of it is: a shell script that suddenly has data that looks like a compressed file. 

Of course detecting the 'shell scriptness' should try to match the usual she-bang lines, and it should try to find a compressed file header by reading each byte and try. I'm not sure if ark's current arch allows such a thing.