Strip signing password from the output of --info
diff --git a/makeself.sh b/makeself.sh index 92fb498..b391add 100755 --- a/makeself.sh +++ b/makeself.sh
@@ -10,7 +10,7 @@ # # Makeself home page: https://makeself.io/ - Version history available on GitHub # -# (C) 1998-2023 by Stephane Peter <megastep@megastep.org> +# (C) 1998-2025 by Stephane Peter <megastep@megastep.org> # # This software is released under the terms of the GNU GPL version 2 and above # Please read the license at http://www.gnu.org/copyleft/gpl.html @@ -19,11 +19,29 @@ MS_VERSION=2.6.0 MS_COMMAND="$0" +MS_SIGN_NEXT=n unset CDPATH for f in ${1+"$@"}; do + if test "$MS_SIGN_NEXT" = y; then + arg_value="XXXX" + MS_SIGN_NEXT=n + else + case "$f" in + --sign) + MS_SIGN_NEXT=y + arg_value="$f" + ;; + --sign=*) + arg_value="--sign=XXXX" + ;; + *) + arg_value="$f" + ;; + esac + fi MS_COMMAND="$MS_COMMAND \\\\ - \\\"$f\\\"" + \\\"$arg_value\\\"" done # For Solaris systems
diff --git a/test/compextratest b/test/compextratest index 21d7c48..cd8c839 100644 --- a/test/compextratest +++ b/test/compextratest
@@ -3,17 +3,26 @@ THIS="$(readlink -f "$0")" THISDIR="$(dirname "${THIS}")" SUT="$(dirname "${THISDIR}")/makeself.sh" +temp="" +pushed=n setupTests() { temp=$(mktemp -d -t XXXXX) - pushd "${temp}" + pushd "${temp}" >/dev/null + pushed=y mkdir src echo "echo This is a test" > src/startup.sh } tearDown() { - popd - rm -rf "${temp}" + if test "${pushed}" = y; then + popd >/dev/null || true + fi + if test -n "${temp}"; then + rm -rf "${temp}" + fi + temp="" + pushed=n } testCompExtraOpts() {
diff --git a/test/datetest b/test/datetest index 1d56a53..8a83f2a 100644 --- a/test/datetest +++ b/test/datetest
@@ -4,18 +4,27 @@ THISDIR="$(dirname "${THIS}")" SRCDIR="$(dirname "${THISDIR}")" SUT="${SRCDIR}/makeself.sh" +temp="" +orig_dir="" setUp() { temp="$(mktemp -dt datetest.XXXXX)" - cd "${temp}" + orig_dir="$(pwd)" + pushd "${temp}" >/dev/null mkdir src echo "echo This is a test" > src/startup.sh } tearDown() { # Cleanup - cd - - rm -rf "${temp}" + if test -n "${orig_dir}"; then + popd >/dev/null || cd "${orig_dir}" + fi + if test -n "${temp}"; then + rm -rf "${temp}" + fi + temp="" + orig_dir="" } # Default behaviour is to insert the current date in the
diff --git a/test/infotest b/test/infotest index 05b98ab..ed60230 100644 --- a/test/infotest +++ b/test/infotest
@@ -4,10 +4,7 @@ THISDIR="$(dirname "${THIS}")" SRCDIR="$(dirname "${THISDIR}")" VERSION="$(cat "${SRCDIR}/VERSION")" - -is_alpine_distro=false && [[ -f "/etc/alpine-release" ]] && is_alpine_distro=true - -uncompressed_size="12 KB" && [[ $is_alpine_distro == true ]] && uncompressed_size="4 KB" +UNCOMPRESSED_PLACEHOLDER="@SIZE@" ################################################################################ @@ -32,7 +29,7 @@ local rc="" cd "$(mktemp -d)" || return 1 cat >want.info - haveInfo "$@" >have.info + haveInfo "$@" | sed 's/^Uncompressed size: .*/Uncompressed size: '"${UNCOMPRESSED_PLACEHOLDER}"'/' >have.info if diff want.info have.info >&2; then rc="$?" else @@ -47,7 +44,7 @@ diffInfo --packaging-date "@0" <<EOF Identification: infotest Target directory: infotest -Uncompressed size: $uncompressed_size +Uncompressed size: ${UNCOMPRESSED_PLACEHOLDER} Compression: gzip Encryption: n Date of packaging: @0 @@ -72,7 +69,7 @@ diffInfo --packaging-date "@0" --nocomp <<EOF Identification: infotest Target directory: infotest -Uncompressed size: $uncompressed_size +Uncompressed size: ${UNCOMPRESSED_PLACEHOLDER} Compression: none Encryption: n Date of packaging: @0 @@ -98,7 +95,7 @@ diffInfo --packaging-date "@0" --notemp <<EOF Identification: infotest Target directory: infotest -Uncompressed size: $uncompressed_size +Uncompressed size: ${UNCOMPRESSED_PLACEHOLDER} Compression: gzip Encryption: n Date of packaging: @0 @@ -119,6 +116,33 @@ assertEquals "$?" 0 ) +testSignMasksPassphrase() ( + cd "$(mktemp -d)" || return 1 + diffInfo --packaging-date "@0" --sign "topsecret" <<EOF +Identification: infotest +Target directory: infotest +Uncompressed size: ${UNCOMPRESSED_PLACEHOLDER} +Compression: gzip +Encryption: n +Date of packaging: @0 +Built with Makeself version ${VERSION} +Build command was: ./makeself.sh \\ + "--packaging-date" \\ + "@0" \\ + "--sign" \\ + "XXXX" \\ + "./infotest" \\ + "./infotest.run" \\ + "infotest" \\ + "ls" \\ + "-lah" +Script run after extraction: + ls -lah +infotest will be removed after extraction +EOF + assertEquals "$?" 0 +) + ################################################################################ # Load and run shUnit2.
diff --git a/test/preextracttest b/test/preextracttest index 89062fe..f8e0f7c 100755 --- a/test/preextracttest +++ b/test/preextracttest
@@ -3,18 +3,27 @@ THIS="$(readlink -f "$0")" THISDIR="$(dirname "${THIS}")" SUT="$(dirname "${THISDIR}")/makeself.sh" +temp="" +pushed=n setUp() { temp=$(mktemp -d -t XXXXX) - pushd "${temp}" + pushd "${temp}" >/dev/null + pushed=y mkdir src echo "echo This is a test" > src/startup.sh chmod a+x src/startup.sh } tearDown() { - popd - rm -rf "${temp}" + if test "${pushed}" = y; then + popd >/dev/null || true + fi + if test -n "${temp}"; then + rm -rf "${temp}" + fi + temp="" + pushed=n } testPreextractOpts() {
diff --git a/test/tarextratest b/test/tarextratest index 10ffc32..1437cbe 100644 --- a/test/tarextratest +++ b/test/tarextratest
@@ -3,17 +3,26 @@ THIS="$(readlink -f "$0")" THISDIR="$(dirname "${THIS}")" SUT="$(dirname "${THISDIR}")/makeself.sh" +temp="" +pushed=n setupTests() { temp=$(mktemp -d -t XXXXX) - pushd "${temp}" + pushd "${temp}" >/dev/null + pushed=y mkdir -p src/.git echo "echo This is a test" > src/startup.sh } tearDown() { - popd - rm -rf "${temp}" + if test "${pushed}" = y; then + popd >/dev/null || true + fi + if test -n "${temp}"; then + rm -rf "${temp}" + fi + temp="" + pushed=n } testTarExtraOpts() {