Strip signing password from the output of --info

This commit is contained in:
Stephane Peter
2025-12-09 13:53:36 -08:00
parent a9d64f31b9
commit 38c132ef2f
6 changed files with 100 additions and 22 deletions
+20 -2
View File
@@ -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
+12 -3
View File
@@ -3,17 +3,26 @@ set -eu
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() {
+12 -3
View File
@@ -4,18 +4,27 @@ THIS="$(readlink -f "$0")"
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
+32 -8
View File
@@ -4,10 +4,7 @@ THIS="$(readlink -f "$0")"
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 @@ diffInfo() {
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 @@ testDefault() (
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 @@ testNocomp() (
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 @@ testNotemp() (
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 @@ EOF
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.
+12 -3
View File
@@ -3,18 +3,27 @@ set -eu
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() {
+12 -3
View File
@@ -3,17 +3,26 @@ set -eu
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() {