Selaa lähdekoodia

add new module

belliash 7 vuotta sitten
vanhempi
commit
fd68ef8fb4
2 muutettua tiedostoa jossa 31 lisäystä ja 0 poistoa
  1. 3
    0
      config/modules/portage-snapshot.conf
  2. 28
    0
      modules/portage-snapshot.ezmod

+ 3
- 0
config/modules/portage-snapshot.conf Näytä tiedosto

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

+ 28
- 0
modules/portage-snapshot.ezmod Näytä tiedosto

@@ -0,0 +1,28 @@
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
+
8
+ezsync_postcommit() {
9
+	printInfo "Creating Portage tree snapshot..."
10
+	snapshotPortage ${PRODUCTION_PORTAGE[0]} ${PRODUCTION_PORTAGE[1]} || return 1
11
+	local SNAPSHOTS=$(find ${SNAPSHOTSDIR} -type f -name \*.xz | sort -r)
12
+	local n=0
13
+	for ARCHIVE in ${SNAPSHOTS}; do
14
+		if [[ ${n} < ${ARCHIVESTOKEEP} ]]; then
15
+			((n++))
16
+			continue
17
+		fi
18
+		rm -f ${ARCHIVE}
19
+		rm -f ${ARCHIVE}.*
20
+	done
21
+	if [ ${REMOTEDOWNLOAD} != "" ]; then
22
+		printInfo "Synchronizing remote download..."
23
+		run "rsync --archive --compress --copy-links --delete-after \
24
+			--safe-links --verbose --rsh=\"${BINDIR}/ssh_wrapper.sh\" \
25
+			\"${SNAPSHOTSDIR}/\" \"${REMOTEDOWNLOAD}/snapshots\"" || return 1
26
+	fi
27
+	return 0
28
+}

Loading…
Peruuta
Tallenna