Skip to content

Commit 4336c0c

Browse files
fix(install): accept common truthy values for OPENSHELL_NO_VERIFY
- Accept 1, true, yes, y (case-insensitive) for OPENSHELL_NO_VERIFY - Clean up temp directory in e2e checksum skip test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: areporeporepo <areporeporepo@users.noreply.github.com>
1 parent 5e4663a commit 4336c0c

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

e2e/install/sh_test.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ test_guidance_mentions_restart() {
7171
test_skip_checksum_env() {
7272
printf 'TEST: OPENSHELL_NO_VERIFY=1 skips checksum verification\n'
7373

74-
_skip_dir="$(mktemp -d)/bin"
74+
_skip_base="$(mktemp -d)"
75+
_skip_dir="${_skip_base}/bin"
7576
_skip_output="$(OPENSHELL_NO_VERIFY=1 \
7677
OPENSHELL_INSTALL_DIR="$_skip_dir" \
7778
SHELL="/bin/sh" \
7879
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
7980
sh "$INSTALL_SCRIPT" 2>&1)" || {
8081
fail "install succeeds with OPENSHELL_NO_VERIFY=1" "exit code: $?"
82+
rm -rf "$_skip_base"
8183
return 1
8284
}
8385

@@ -89,6 +91,7 @@ test_skip_checksum_env() {
8991
else
9092
fail "binary installed with checksum skip" "not found at $_skip_dir/openshell"
9193
fi
94+
rm -rf "$_skip_base"
9295
}
9396

9497
test_no_env_scripts_created() {

install.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,12 @@ is_on_path() {
227227
# ---------------------------------------------------------------------------
228228

229229
main() {
230-
_skip_checksum="${OPENSHELL_NO_VERIFY:-0}"
230+
# Normalise OPENSHELL_NO_VERIFY to "1" or "0".
231+
# Accept common truthy values: 1, true, yes, y (case-insensitive).
232+
case "$(printf '%s' "${OPENSHELL_NO_VERIFY:-}" | tr '[:upper:]' '[:lower:]')" in
233+
1|true|yes|y) _skip_checksum=1 ;;
234+
*) _skip_checksum=0 ;;
235+
esac
231236

232237
# Parse CLI flags
233238
for arg in "$@"; do

0 commit comments

Comments
 (0)