ima-setup: fix two shellcheck warnings

Relates: https://issues.redhat.com/browse/RHEL-82392
Conflict: None

Upstream Status: https://src.fedoraproject.org/rpms/ima-evm-utils.git

commit 7b800d82d0947fd0e75e92997a3aec7af079c1cc
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Feb 25 13:24:33 2025 +0800

    ima-setup: fix two shellcheck warnings

    Fix the following two shellcheck warnings,

        In ima-setup.sh line 36:
                                echo "$policy_file doesn't exist"
                                      ^----------^ SC2154 (warning): policy_file is referenced but not assigned.

        In ima-setup.sh line 41:
                        reinstall_threshold=${_opt#*=}
                        ^-----------------^ SC2034 (warning): reinstall_threshold appears unused. Verify use (or export if used externally).

    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2025-03-06 16:47:57 +08:00
parent 3f5494f50f
commit d6d9da7af7

View File

@ -33,7 +33,7 @@ for _opt in "$@"; do
--policy=*)
ima_policy_path=${_opt#*=}
if [[ ! -e $ima_policy_path ]]; then
echo "$policy_file doesn't exist"
echo "$ima_policy_path doesn't exist"
exit 1
fi
;;
@ -61,7 +61,7 @@ if test -f /run/ostree-booted; then
echo "You are using OSTree, please enable IMA signatures as part of the OSTree creation process."
else
echo "Adding IMA signatures to installed package files"
if ! ima-add-sigs; then
if ! ima-add-sigs --reinstall_threshold="$reinstall_threshold"; then
echo "Failed to add IMA signatures, abort"
exit 1
fi