admin scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
848 B

  1. #!/bin/bash
  2. FILENAME="rbpkg-packages-report"
  3. # Move what happened yeterday to old log
  4. if [ -f /var/log/$FILENAME.log ]; then
  5. mv /var/log/$FILENAME.log /var/log/$FILENAME.log.old
  6. fi
  7. if [ -f /var/log/$FILENAME.daily ]; then
  8. rm /var/log/$FILENAME.daily
  9. fi
  10. # log packages here today
  11. find ~rbpkg/packages -type f -name "*.deb" > /var/log/$FILENAME.log
  12. for package in $(cat /var/log/$FILENAME.log /var/log/$FILENAME.log.old /var/log/$FILENAME.log.old | sort | uniq -u) ; do
  13. LINES=$(apt-listchanges -f text -a $package 2>/dev/null | grep -m1 -n " -- " | awk -F: '{print $1}')
  14. apt-listchanges -f text -a $package 2> /dev/null | head -n$LINES >> /var/log/$FILENAME.daily
  15. echo >> /var/log/$FILENAME.daily
  16. done
  17. if [ -s /var/log/$FILENAME.daily ]; then
  18. cat /var/log/$FILENAME.daily | mutt -s "RB Package Report" system-reports@redbrick.dcu.ie
  19. fi