I'm trying to make self extracting file using the following Ant tasks:
...
<fixcrlf file="${src.dir}/scripts/install.sh" eol="unix"/>
<concat destfile="${build.dir}/my_program.exe" binary="yes">
<fileset file="${src.dir}/scripts/install.sh" />
<fileset file="${build.dir}/program.tar.gz" />
</concat>
.. and my_program.exe looks like this:
#!/bin/bash
begin=`head -30 $0 | grep -n ^START | cut -d ':' -f -1` # find line number of the marker
start=$(($begin+1)) # beginning of the binary archive which will be extracted
echo $start
...
START
#binary file starts
When I run my_program.exe I get the following error:
./my_program.exe: line 4: Binary file (standard input) matches: syntax error in expression (error token is "file (standard input) matches")
tail: +: invalid number of lines
When I run install.sh separately it finds line number just fine.
My guess is that something wrong with Ant task. Do I miss some properties that will fix it?