From e212d91a6f8fd9eae9bb7883081d4fd971ec749e Mon Sep 17 00:00:00 2001 From: Don Penney Date: Mon, 16 Apr 2018 10:02:47 -0400 Subject: [PATCH] Update patching rpm-audit to handle both sha256 and md5 checksums Change-Id: I7e3a7f3cf47488ae55eecf93ee1b5c9fb2f7f763 Signed-off-by: Don Penney --- cgcs-patch/bin/rpm-audit | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cgcs-patch/bin/rpm-audit b/cgcs-patch/bin/rpm-audit index 2d17201d..3ae2755c 100755 --- a/cgcs-patch/bin/rpm-audit +++ b/cgcs-patch/bin/rpm-audit @@ -101,9 +101,9 @@ do continue fi - if [[ $INCLUDE_PYTHON_FILES == "no" && $pname =~ \.py[co]?$ ]] + if [[ $INCLUDE_PYTHON_FILES == "no" && $pname =~ \.py[co]$ ]] then - # Skip python .py or .pyc file + # Skip python .pyo or .pyc file continue fi @@ -135,7 +135,15 @@ do continue fi - echo $psum $pname | sha256sum --check --status + let -i sumlen=$(echo -n $psum | wc -c) + if [ $sumlen = 64 ] + then + sumcmd=sha256sum + else + sumcmd=md5sum + fi + + echo $psum $pname | $sumcmd --check --status if [ $? -ne 0 ] then echo "Mismatch: $pname ($pkg)"