diff --git a/makeself-header.sh b/makeself-header.sh index a9d16ae..53e3577 100755 --- a/makeself-header.sh +++ b/makeself-header.sh @@ -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 } diff --git a/makeself.1 b/makeself.1 index 392384e..be84973 100644 --- a/makeself.1 +++ b/makeself.1 @@ -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 diff --git a/makeself.sh b/makeself.sh index aa55dc0..478b0ab 100755 --- a/makeself.sh +++ b/makeself.sh @@ -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 diff --git a/test/nochecktest b/test/nochecktest new file mode 100755 index 0000000..dd826a7 --- /dev/null +++ b/test/nochecktest @@ -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"