Skip to content

Commit

Permalink
fix #318: document and test SETUP_NOCHECK (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
the-real-neil committed Nov 6, 2023
1 parent 98b312a commit 9414c66
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions makeself-header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions makeself.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions makeself.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 42 additions & 0 deletions test/nochecktest
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 9414c66

Please sign in to comment.