Skip to content

Commit

Permalink
dist: adjust script imports to be able to use /usr/libexec
Browse files Browse the repository at this point in the history
In order to make installation easier for distributions, make all script
imports based on a single variable that distributions can adjust based
on how the script is packaged for each distribution.

Ideally we would actually install the script in /usr/libexec rather than
/ in our Dockerfile, but this is a simpler fix that still lets you run
the script from the repo directory.

Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Oct 18, 2024
1 parent 5c42b8a commit a18798f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docker-bench-security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

version='1.6.0'

LIBEXEC="." # Distributions can change this to /usr/libexec or similar.

# Load dependencies
. ./functions/functions_lib.sh
. ./functions/helper_lib.sh
. $LIBEXEC/functions/functions_lib.sh
. $LIBEXEC/functions/helper_lib.sh

# Setup the paths
this_path=$(abspath "$0") ## Path of this file including filename
Expand Down Expand Up @@ -99,7 +101,7 @@ do
done

# Load output formating
. ./functions/output_lib.sh
. $LIBEXEC/functions/output_lib.sh

yell_info

Expand Down Expand Up @@ -161,8 +163,8 @@ main () {
images=$(docker images -q $LABELS| grep -v "$benchcont")
fi

for test in tests/*.sh; do
. ./"$test"
for test in $LIBEXEC/tests/*.sh; do
. "$test"
done

if [ -z "$check" ] && [ ! "$checkexclude" ]; then
Expand Down

0 comments on commit a18798f

Please sign in to comment.