Skip to content

Commit

Permalink
bug fix: fix mktemp on macos and escaping backslashes on alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoberezhniy authored and megastep committed Mar 24, 2024
1 parent c9365df commit 271b54a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
15 changes: 4 additions & 11 deletions makeself-header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ scriptargs="$SCRIPTARGS"
cleanup_script="${CLEANUP_SCRIPT}"
licensetxt="$LICENSE"
helpheader="${HELPHEADER}"
preextract='
EOF
if test -n "${PREEXTRACT_FILE}"; then
sed -e "s/['\\]/\\\\&/g" "${PREEXTRACT_FILE}" >> "$archname"
fi
cat << EOF >> "$archname"
'
preextract="\${preextract#?}"; preextract="\${preextract%?}" # trim redundant newlines
preextract="${PREEXTRACT_ENCODED}"
targetdir="$archdirname"
filesizes="$filesizes"
totalsize="$totalsize"
Expand Down Expand Up @@ -326,8 +319,8 @@ MS_Preextract()
fi
fi
prescript=\`mktemp -t XXXXX -p "\$tmpdir"\`
echo "\$preextract" > "\$prescript"
prescript=\`mktemp "\$tmpdir/XXXXXX"\`
echo "\$preextract" | base64 -d > "\$prescript"
chmod a+x "\$prescript"
(cd "\$tmpdir"; eval "\"\$prescript\" \$scriptargs \"\\\$@\""); res=\$?
Expand Down Expand Up @@ -495,7 +488,7 @@ EOLSM
echo "Pre-extraction script is not provided." >&2
exit 1
fi
echo "\$preextract"
echo "\$preextract" | base64 -d
exit 0
;;
--confirm)
Expand Down
5 changes: 3 additions & 2 deletions makeself.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ do
shift 2 || { MS_Usage; exit 1; }
;;
--preextract)
PREEXTRACT_FILE="$2"
preextract_file="$2"
shift 2 || { MS_Usage; exit 1; }
test -r "$PREEXTRACT_FILE" || { echo "Unable to open pre-extraction script: $PREEXTRACT_FILE" >&2; exit 1; }
test -r "$preextract_file" || { echo "Unable to open pre-extraction script: $preextract_file" >&2; exit 1; }
PREEXTRACT_ENCODED=`base64 "$preextract_file"`
;;
--cleanup)
CLEANUP_SCRIPT="$2"
Expand Down

0 comments on commit 271b54a

Please sign in to comment.