ezbuild/modules/local-mirror.ezmod

25 lines
831 B
Plaintext
Raw Normal View History

2012-01-17 11:29:03 +01:00
# Copyright 2010-2012, Asio Software Technologies
# Distributed under the terms of the GNU General Public License v3
EZMOD_DESCRIPTION="Synchronizes local Portage mirror"
EZMOD_COMPATIBILITY="ezsync"
EZMOD_AUTHOR="Rafal Kupiec"
EZMOD_VERSION="1.0"
ezsync_postcommit() {
2012-01-17 23:26:41 +01:00
if [ "${LOCALMIRRORPATH}" != "" ]; then
2012-01-17 11:29:03 +01:00
printInfo "Synchronizing local Portage mirror..."
if [ "$(toUpper ${PORTAGE_BUILD[1]})" != "GIT" ]; then
printWarn "Local mirror actually supports only GIT!"
2012-01-17 14:52:00 +01:00
return 0
2012-01-17 11:29:03 +01:00
fi
2012-01-17 23:26:41 +01:00
if [ -d ${LOCALMIRRORPATH} ]; then
cd ${LOCALMIRRORPATH}
run "su ${LOCALMIRRORUSER} -s \"/bin/sh\" -c \"git fetch --all\"" || return 1
2012-01-17 11:29:03 +01:00
else
2012-01-17 23:26:41 +01:00
makeDirectory ${LOCALMIRRORPATH}
run "su ${LOCALMIRRORUSER} -s \"/bin/sh\" -c \"git clone --mirror --bare ${PORTAGE_BUILD[2]} ${LOCALMIRRORPATH}\"" || return 1
2012-01-17 11:29:03 +01:00
fi
fi
return 0
}