bugfix: no error code was returned on mismatch

This commit is contained in:
tastytea 2018-05-22 00:40:08 +02:00
parent 292ed4e82b
commit eae92415f8
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5

View File

@ -12,7 +12,7 @@
# meet some day, and you think this stuff is worth it, you can give us a hug. # # meet some day, and you think this stuff is worth it, you can give us a hug. #
################################################################################### ###################################################################################
VERSION="0.9.4" VERSION="0.9.5"
PATH="/bin:/usr/bin:/sbin:/usr/sbin:${PATH}" PATH="/bin:/usr/bin:/sbin:/usr/sbin:${PATH}"
DIGEST_FILE="/var/lib/hashboot.digest" DIGEST_FILE="/var/lib/hashboot.digest"
@ -221,7 +221,7 @@ then
if [ $((${CKMODES} & 001)) != 0 ]; then if [ $((${CKMODES} & 001)) != 0 ]; then
dd if=${MBR_DEVICE} of=${MBR_TMP} bs=${MBR_SIZE}K count=1 status=${DD_STATUS} || die 8 dd if=${MBR_DEVICE} of=${MBR_TMP} bs=${MBR_SIZE}K count=1 status=${DD_STATUS} || die 8
grep ${MBR_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee ${LOG_FILE} grep ${MBR_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee ${LOG_FILE}
if [ ${PIPESTATUS[1]} -ne 0 ] if [ ${PIPESTATUS[2]} -ne 0 ]
then then
echo " !! TIME TO PANIK: MBR WAS MODIFIED !!" echo " !! TIME TO PANIK: MBR WAS MODIFIED !!"
COUNTER=$((COUNTER + 1)) COUNTER=$((COUNTER + 1))
@ -229,7 +229,7 @@ then
fi fi
if [ $((${CKMODES} & 010)) != 0 ]; then if [ $((${CKMODES} & 010)) != 0 ]; then
grep -v ${MBR_TMP} ${DIGEST_FILE} | grep -v ${BIOS_TMP} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE} grep -v ${MBR_TMP} ${DIGEST_FILE} | grep -v ${BIOS_TMP} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE}
if [ ${PIPESTATUS[1]} -ne 0 ] if [ ${PIPESTATUS[2]} -ne 0 ]
then then
echo " !! TIME TO PANIK: AT LEAST 1 FILE WAS MODIFIED !!" echo " !! TIME TO PANIK: AT LEAST 1 FILE WAS MODIFIED !!"
COUNTER=$((COUNTER + 2)) COUNTER=$((COUNTER + 2))
@ -240,7 +240,7 @@ then
#if we set an programmer chip in config, find line with hash for bios and compare. if smthg wrong, panic #if we set an programmer chip in config, find line with hash for bios and compare. if smthg wrong, panic
if [ ! ${PROGRAMMER} == "no" ]; then if [ ! ${PROGRAMMER} == "no" ]; then
grep ${BIOS_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE} grep ${BIOS_TMP} ${DIGEST_FILE} | ${HASHER} --check --warn --quiet --strict | tee -a ${LOG_FILE}
if [ ${PIPESTATUS[1]} -ne 0 ] if [ ${PIPESTATUS[2]} -ne 0 ]
then then
echo " !! TIME TO PANIK: BIOS WAS MODIFIED !!" echo " !! TIME TO PANIK: BIOS WAS MODIFIED !!"
COUNTER=$((COUNTER + 10)) COUNTER=$((COUNTER + 10))