#!/bin/sh

echo "=============================================================="
echo "WARNING: Additional commands may be required after running yum"
echo "=============================================================="

BEFORE=$(rpm -qa 2>&1 | sed '/skipping V4 signature/d' | md5sum)

/usr/bin/yum "$@"
status=$?

AFTER=$(rpm -qa 2>&1 | sed '/skipping V4 signature/d' | md5sum)
if [ "$BEFORE" = "$AFTER" ]
then
  echo "================================================================"
  echo "No new rpms were installed. No additional commands are required."
  echo "================================================================"
else
  echo "=============================================================="
  echo "WARNING: You now need to run BOTH of the following commands"
  echo "to ensure consistent system state:"
  echo
  echo "signal-event post-upgrade; signal-event reboot"
  echo
  echo "You should run these commands unless you are certain that"
  echo "yum made no changes to your system."
  echo "=============================================================="
fi

exit $status
