Fix shellcheck warning and typos

Relates: https://issues.redhat.com/browse/RHEL-105471

Upstream: Fedora
Conflict: None

Fix the following shellcheck warning,
    In ima-add-sigs.sh line 135:
    unsigned_packages_in_rpm_db=$(rpm -q --queryformat "%{SIGPGP:pgpsig}\n" "$package" | grep "^(none)$" | wc -l)
                                                                                     ^-------------^ SC2126 (style): Consider using 'grep -c' instead of 'grep|wc -l'.
Also fix two typos.

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2025-07-25 09:11:06 +08:00
parent 906f02a955
commit 87fa93358e

View File

@ -4,7 +4,7 @@
usage() {
echo "Add IMA signatures to installed packages."
cat <<EOF
usage: $0 [--package=PACKAGE_NAME|ALL] [--ima-cert=IMA_CERT_PATH] [--reinstall_threshold=NUM]
usage: $0 [--package=PACKAGE_NAME|ALL] [--ima_cert=IMA_CERT_PATH] [--reinstall_threshold=NUM]
--package
By default, it will add IMA sigantures to all installed package files.
@ -19,7 +19,7 @@ usage: $0 [--package=PACKAGE_NAME|ALL] [--ima-cert=IMA_CERT_PATH] [--reinstall_t
this case by checking if there are >reinstall_threshold package missing
IMA signatures.
--ima-cert
--ima_cert
With the signing IMA cert path specified, it will also try to verify the
added IMA signature.
@ -132,7 +132,7 @@ if [[ -z $reinstall_threshold ]]; then
fi
fi
unsigned_packages_in_rpm_db=$(rpm -q --queryformat "%{SIGPGP:pgpsig}\n" "$package" | grep "^(none)$" | wc -l)
unsigned_packages_in_rpm_db=$(rpm -q --queryformat "%{SIGPGP:pgpsig}\n" "$package" | grep -c "^(none)$")
if [[ $unsigned_packages_in_rpm_db -ge $reinstall_threshold ]]; then
add_by_reinstall