Browse Source

Add local-mirror module

master
belliash 7 years ago
parent
commit
b132748288
2 changed files with 31 additions and 0 deletions
  1. 7
    0
      config/modules/local-mirror.conf
  2. 24
    0
      modules/local-mirror.ezmod

+ 7
- 0
config/modules/local-mirror.conf View File

@@ -0,0 +1,7 @@
# This specifies the local repository with the base path. This is the directory, where
# Portage mirror will be saved. Don't forget to uncomment this option!
#LOCALMIRROR_PATH="/path/to/portage-mirror.git"

# Directive sets a username, that will be used to pull changes from remote repository.
# This is useful when the local daemon is running with different permissions.
LOCALMIRROR_USER="root"

+ 24
- 0
modules/local-mirror.ezmod View File

@@ -0,0 +1,24 @@
# 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() {
if [ "${LOCALMIRROR_PATH}" != "" ]; then
printInfo "Synchronizing local Portage mirror..."
if [ "$(toUpper ${PORTAGE_BUILD[1]})" != "GIT" ]; then
printWarn "Local mirror actually supports only GIT!"
return 1
fi
if [ -d ${LOCALMIRROR_PATH} ]; then
cd ${LOCALMIRROR_PATH}
run "su ${LOCALMIRROR_USER} -s \"/bin/sh\" -c \"git fetch --all\"" || return 1
else
makeDirectory ${LOCALMIRROR_PATH}
run "su ${LOCALMIRROR_USER} -s \"/bin/sh\" -c \"git clone --mirror --bare ${PORTAGE_BUILD[2]} ${LOCALMIRROR_PATH}\"" || return 1
fi
fi
return 0
}

Loading…
Cancel
Save