Skip to content

Commit 75e40ec

Browse files
committed
refactoring
1 parent 3b060b5 commit 75e40ec

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

usr/libexec/helper-scripts/strings.bsh

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,18 @@
33
## Copyright (C) 2025 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
44
## See the file COPYING for copying conditions.
55

6-
## Code duplication. Copied from
7-
## helper-scripts/usr/libexec/helper-scripts/check_runtime.bsh.
8-
##
9-
## Because check_runtime.bsh cannot be sourced here (this will be run when
6+
## check_runtime.bsh cannot be sourced here (this will be run when
107
## derivative-maker is used, and the build host may not have helper-scripts
118
## installed).
12-
was_executed() {
13-
local caller_bash_source_zero="${1}"
14-
if [[ "${caller_bash_source_zero}" == "${0}" ]] \
15-
|| [[ "${caller_bash_source_zero}" == "$(command -v "${0}")" ]]; then
16-
return 0
17-
fi
18-
return 1
19-
}
20-
should_run_unit_tests() {
21-
local caller_bash_source_zero="${1}"
22-
if was_executed "${caller_bash_source_zero}" \
23-
&& ! [ "${SKIP_UNIT_TESTS-}" = 'true' ]; then
24-
return 0
25-
fi
26-
return 1
27-
}
9+
## Literal code duplication is bad.
10+
## Confuses shellcheck for dist-installer-cli-standalone.
11+
if test -f /usr/libexec/helper-scripts/check_runtime.bsh; then
12+
## Use 'source_encoded' to avoid
13+
## /usr/share/usability-misc/build-dist-installer-cli
14+
## from in-lining the source code.
15+
source_encoded=source
16+
"$source_encoded" /usr/libexec/helper-scripts/check_runtime.bsh
17+
fi
2818

2919
br_add() {
3020
local in out

0 commit comments

Comments
 (0)