fix #318: document and test SETUP_NOCHECK (#319)

This commit is contained in:
the-real-neil
2023-11-06 21:53:04 +00:00
committed by GitHub
parent 98b312a332
commit 9414c66538
4 changed files with 53 additions and 0 deletions

View File

@@ -191,6 +191,10 @@ Makeself version $MS_VERSION
--cleanup-args args Arguments to the cleanup script. Wrap in quotes to provide
multiple arguments.
-- Following arguments will be passed to the embedded script\${helpheader}
ENVIRONMENT
SETUP_NOCHECK
If set to 1, then checksum validation will be skipped.
EOH
}

View File

@@ -140,7 +140,10 @@ Append a license file.
.TP
.B --packaging-date date
Use provided string as the packaging date instead of the current date.
.SH "ENVIRONMENT"
.TP
.B SETUP_NOCHECK
If set to 1, then checksum validation will be skipped.
.SH "EXAMPLES"
Here is an example, assuming the user has a package image stored in a /home/joe/mysoft,
and he wants to generate a self-extracting package named mysoft.sh, which will launch

View File

@@ -110,6 +110,10 @@ MS_Usage()
echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive."
echo " --export-conf : Export configuration variables to startup_script"
echo
echo "ENVIRONMENT"
echo " SETUP_NOCHECK"
echo " If set to 1, then checksum validation will be skipped."
echo
echo "Do not forget to give a fully qualified startup script name"
echo "(i.e. with a ./ prefix if inside the archive)."
exit 1

42
test/nochecktest Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
set -eu
THIS="$(readlink -f "$0")"
THISDIR="$(dirname "${THIS}")"
SUT="$(dirname "${THISDIR}")/makeself.sh"
testNoCheck() {
# Create a directory with a simple payload.
local archive_dir
archive_dir="$(mktemp -dt archive_dir.XXXXXX)"
(
cd "${archive_dir}"
touch foo.txt bar.txt qux.txt
)
# Create a self-extracting archive.
local file_name
file_name="$(mktemp -t file_name.XXXXXX)"
"${SUT}" --nox11 --sha256 "${archive_dir}" "${file_name}" "no check test" true
assertEquals "$?" 0
printf '\nArchive verification enabled:\n' >&2
sync
"${file_name}" 2>&1
assertEquals "$?" 0
"${file_name}" 2>&1 | grep -qF 'Verifying archive integrity...'
assertEquals "$?" 0
printf '\nArchive verification disabled:\n' >&2
SETUP_NOCHECK=1 "${file_name}" 2>&1
assertEquals "$?" 0
SETUP_NOCHECK=1 "${file_name}" 2>&1 | grep -qFv 'Verifying archive integrity...'
assertEquals "$?" 0
# Clean up.
rm -rf "${archive_dir}" "${file_name}"
}
# Load and run shUnit2.
source "./shunit2/shunit2"