Removes .rpmnew files created by yum that are identical to their source


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3. #This script searches for .rpmnew files created by yum that are actually identical
  4. #to their base file and removes them.
  5. updatedb
  6. FILES=$(locate .rpmnew)
  7. for FILE in ${FILES}
  8. do
  9. MD1=`echo $FILE | sed 's/.rpmnew//' | xargs md5sum | awk '{print $1}'`
  10. MD2=`md5sum $FILE | awk '{print $1}'`
  11. if [ $MD1 == $MD2 ]
  12. then
  13. echo "$FILE removed as it was identical"
  14. rm $FILE
  15. fi
  16. done
  17. updatedb

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.