reGen2 Linux Release Metatool
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.

update-notification.ezmod 1.7KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright 2010-2012, Asio Software Technologies
  2. # Distributed under the terms of the GNU General Public License v3
  3. EZMOD_DESCRIPTION="Sends a notification about packages that need an update"
  4. EZMOD_COMPATIBILITY="ezsync"
  5. EZMOD_AUTHOR="Rafal Kupiec"
  6. EZMOD_VERSION="1.0"
  7. ezsync_postcommit() {
  8. local BUILDVER MAINLINEVER NEEDSUPDATE NEWER PACKAGE
  9. local SENDMESG=0
  10. if [ "${UPDATENOTIFY}" != "" ]; then
  11. for PACKAGE in ${CHECKPACKAGES[*]}; do
  12. makeCleanDirectory ${TEMPDIR}/ebuilds
  13. makeDirectory ${TEMPDIR}/ebuilds/build
  14. makeDirectory ${TEMPDIR}/ebuilds/mainline
  15. run "cp -apf ${PORTAGESDIR}/${PORTAGE_BUILD[0]}/${PACKAGE}/*.ebuild ${TEMPDIR}/ebuilds/build/" || return 1
  16. run "cp -apf ${PORTAGESDIR}/${PORTAGE_MAINLINE[0]}/${PACKAGE}/*.ebuild ${TEMPDIR}/ebuilds/mainline/" || return 1
  17. find ${TEMPDIR}/ebuilds -type f -name \*-9999\*.ebuild -exec rm -rf {} \;
  18. BUILDVER=$(find ${TEMPDIR}/ebuilds/build -type f | sed -u -e "s/.ebuild//g" -e "s/-r/_z/g" -e "s/_p/_z/g" -e "s/_zre/_pre/" -e "s/$/_z0/" | sed "/^$/d" | sort -Vr | head -1)
  19. BUILDVER=${BUILDVER##*/}
  20. MAINLINEVER=$(find ${TEMPDIR}/ebuilds/mainline -type f | sed -u -e "s/.ebuild//g" -e "s/-r/_z/g" -e "s/_p/_z/g" -e "s/_zre/_pre/" -e "s/$/_z0/" | sed "/^$/d" | sort -Vr | head -1)
  21. MAINLINEVER=${MAINLINEVER##*/}
  22. NEWER=$(echo -e "${BUILDVER}\n${MAINLINEVER}" | sed "/^$/d" | sort -Vr | head -1)
  23. if [[ "${NEWER}" != "${BUILDVER}" ]]; then
  24. SENDMSG=1
  25. NEEDSUPDATE=${NEEDSUPDATE+"$NEEDSUPDATE, "}"${PACKAGE}"
  26. fi
  27. done
  28. rm -rf ${TEMPDIR}/ebuilds
  29. if isEnabled ${SENDMSG}; then
  30. echo "The following packages needs your attention, because they probably has been updated in mainline Portage tree: ${NEEDSUPDATE}" | mailx -s "Packages need an update!" ${UPDATENOTIFY}
  31. fi
  32. fi
  33. return 0
  34. }