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 @@
1
+# This specifies the local repository with the base path. This is the directory, where
2
+# Portage mirror will be saved. Don't forget to uncomment this option!
3
+#LOCALMIRROR_PATH="/path/to/portage-mirror.git"
4
+
5
+# Directive sets a username, that will be used to pull changes from remote repository.
6
+# This is useful when the local daemon is running with different permissions.
7
+LOCALMIRROR_USER="root"

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

@@ -0,0 +1,24 @@
1
+# Copyright 2010-2012, Asio Software Technologies
2
+# Distributed under the terms of the GNU General Public License v3
3
+EZMOD_DESCRIPTION="Synchronizes local Portage mirror"
4
+EZMOD_COMPATIBILITY="ezsync"
5
+EZMOD_AUTHOR="Rafal Kupiec"
6
+EZMOD_VERSION="1.0"
7
+
8
+ezsync_postcommit() {
9
+	if [ "${LOCALMIRROR_PATH}" != "" ]; then
10
+		printInfo "Synchronizing local Portage mirror..."
11
+		if [ "$(toUpper ${PORTAGE_BUILD[1]})" != "GIT" ]; then
12
+			printWarn "Local mirror actually supports only GIT!"
13
+			return 1
14
+		fi
15
+		if [ -d ${LOCALMIRROR_PATH} ]; then
16
+			cd ${LOCALMIRROR_PATH}
17
+			run "su ${LOCALMIRROR_USER} -s \"/bin/sh\" -c \"git fetch --all\"" || return 1
18
+		else
19
+			makeDirectory ${LOCALMIRROR_PATH}
20
+			run "su ${LOCALMIRROR_USER} -s \"/bin/sh\" -c \"git clone --mirror --bare ${PORTAGE_BUILD[2]} ${LOCALMIRROR_PATH}\"" || return 1
21
+		fi
22
+	fi
23
+	return 0
24
+}

Loading…
Cancel
Save