add new module

This commit is contained in:
belliash 2012-02-04 15:11:47 +01:00
parent bf6d5294c9
commit fd68ef8fb4
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# This option specifies a read-only Portage tree mirror, that allows end-users to
# synchronize to. It will be used to create Portage snapshot.
PRODUCTION_PORTAGE=( "git://remotehost.org/portage.git" "git" )

View File

@ -0,0 +1,28 @@
# Copyright 2010-2012, Asio Software Technologies
# Distributed under the terms of the GNU General Public License v3
EZMOD_DESCRIPTION="Creates a Portage snapshot ready to use at production"
EZMOD_COMPATIBILITY="ezsync"
EZMOD_AUTHOR="Rafal Kupiec"
EZMOD_VERSION="1.0"
ezsync_postcommit() {
printInfo "Creating Portage tree snapshot..."
snapshotPortage ${PRODUCTION_PORTAGE[0]} ${PRODUCTION_PORTAGE[1]} || return 1
local SNAPSHOTS=$(find ${SNAPSHOTSDIR} -type f -name \*.xz | sort -r)
local n=0
for ARCHIVE in ${SNAPSHOTS}; do
if [[ ${n} < ${ARCHIVESTOKEEP} ]]; then
((n++))
continue
fi
rm -f ${ARCHIVE}
rm -f ${ARCHIVE}.*
done
if [ ${REMOTEDOWNLOAD} != "" ]; then
printInfo "Synchronizing remote download..."
run "rsync --archive --compress --copy-links --delete-after \
--safe-links --verbose --rsh=\"${BINDIR}/ssh_wrapper.sh\" \
\"${SNAPSHOTSDIR}/\" \"${REMOTEDOWNLOAD}/snapshots\"" || return 1
fi
return 0
}