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.

portage-snapshot.ezmod 945B

12345678910111213141516171819202122232425262728
  1. # Copyright 2010-2012, Asio Software Technologies
  2. # Distributed under the terms of the GNU General Public License v3
  3. EZMOD_DESCRIPTION="Creates a Portage snapshot ready to use at production"
  4. EZMOD_COMPATIBILITY="ezsync"
  5. EZMOD_AUTHOR="Rafal Kupiec"
  6. EZMOD_VERSION="1.0"
  7. ezsync_postcommit() {
  8. printInfo "Creating Portage tree snapshot..."
  9. snapshotPortage ${PRODUCTION_PORTAGE[0]} ${PRODUCTION_PORTAGE[1]} || return 1
  10. local SNAPSHOTS=$(find ${SNAPSHOTSDIR} -type f -name \*.xz | sort -r)
  11. local n=0
  12. for ARCHIVE in ${SNAPSHOTS}; do
  13. if [[ ${n} < ${ARCHIVESTOKEEP} ]]; then
  14. ((n++))
  15. continue
  16. fi
  17. rm -f ${ARCHIVE}
  18. rm -f ${ARCHIVE}.*
  19. done
  20. if [ ${REMOTEDOWNLOAD} != "" ]; then
  21. printInfo "Synchronizing remote download..."
  22. run "rsync --archive --compress --copy-links --delete-after \
  23. --safe-links --verbose --rsh=\"${BINDIR}/ssh_wrapper.sh\" \
  24. \"${SNAPSHOTSDIR}/\" \"${REMOTEDOWNLOAD}/snapshots\"" || return 1
  25. fi
  26. return 0
  27. }