Skip to content

Commit

Permalink
unix/genSelfExtract: Fix self-extracting script to correctly handle t…
Browse files Browse the repository at this point in the history
…emporary path
  • Loading branch information
nmaguiar committed Jan 27, 2024
1 parent 08f5b28 commit 4222c4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unix/genSelfExtract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ init:
{{#if message}}echo "{{{message}}}"{{else}} {{/if}}
{{#if message}}echo{{else}} {{/if}}
export TMPDIR={{#if tmppath}}{{tmppath}}{{else}}`mktemp -d /tmp/extract.XXXXXX`{{/if}}
{{#if tmppath}}if [ ! -f {{tmppath}}/{{setup}} ]; then /bin/sh -c "mkdir {{tmppath}} && {{/if}}tail -n+{{nlines}} $0 | tar xz -C $TMPDIR"; fi
{{#if tmppath}}if [ ! -f {{tmppath}}/{{setup}} ]; then mkdir {{tmppath}} && {{/if}}$(tail -n+{{nlines}} $0 | tar xz -C $TMPDIR); fi
export CDIR=`pwd`
cd $TMPDIR
chmod u+x {{setup}}
sh ./{{setup}} "$@"
chmod u+x {{#if tmppath}}{{tmppath}}/{{/if}}{{setup}}
sh {{#if tmppath}}{{tmppath}}{{else}}.{{/if}}/{{setup}} "$@"
cd $CDIR
{{#if tmppath}}{{else}}rm -rf $TMPDIR{{/if}}
exit 0
Expand Down

0 comments on commit 4222c4d

Please sign in to comment.