0
I am following this procedure to create a file compactado
autoexecutável
but I’m not succeeding, something is missing?
- Compact the files to
pacote.tar.gz
- I create file
pacote.sh
with the following content:
#!/bin/sh
skip=4
tail +$skip $0 1 | tar -xzf - -C /
exit
- Concateno with
cat pacote.tar.gz >> pacote.sh
To test, I run:
bash pacote.sh
And I get the following mistake:
Tail: could not open "+4" for reading: File or directory not found Tail: could not open "1" for reading: File or directory not found
gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
It wouldn’t be because there was one missing
|
between the commands?tail ... | tar ...
– hkotsubo
I will test hkotsubo
– Miguel Silva
@hkotsubo error now is another, I edited on the question
– Miguel Silva
If I’m not mistaken, the command must be
tail -n +$skip $0
. Only+4
doesn’t work and he thinks it’s a filename, and I don’t understand what that1
is doing there (he also thinks it’s a file). But I don’t know if it’s a good thing to rely only on the number of lines to be skipped, maybe a tag (any string indicating where the content begins) is better: https://www.linuxjournal.com/content/add-binary-payload-your-shell-scripts– hkotsubo
I’ll test and return
– Miguel Silva
@hkotsubo It worked perfectly, I added the
-n
, thepipe
removed the1
and it worked, create an answer for me to vote?– Miguel Silva
Added response
– hkotsubo