path: root/cnf
diff options
authorMichał Górny <mgorny@gentoo.org>2014-12-05 17:12:17 +0100
committerBrian Dolbec <dolsen@gentoo.org>2014-12-06 21:39:22 -0800
commitddf87266433247e1ec9aa90b8ffab99a240be7e4 (patch)
treeb76fcf715a527608996796bd73683b298165dffd /cnf
parentportage/sync/controller.py: Make a repo.postsync.d directory (diff)
Install a verbose example repo.postsync.d script
Brian Dolbec <dolsen@gentoo.org>: Move the example to repo.postsync.d. Remove the final hook run else section for the new independant repo.postsync.d directory. Reword comments for the changes.
Diffstat (limited to 'cnf')
1 files changed, 51 insertions, 0 deletions
diff --git a/cnf/repo.postsync.d/example b/cnf/repo.postsync.d/example
new file mode 100644
index 000000000..533bf719c
--- /dev/null
+++ b/cnf/repo.postsync.d/example
@@ -0,0 +1,51 @@
+# Example /etc/portage/repo.postsync.d script. Make it executable (chmod +x) for
+# Portage to process it.
+# With portage-2.2.16 and newer, all repo.postsync.d hooks will be called multiple
+# times after syncing each repository.
+# Older versions of Portage support syncing only one repository.
+# In those versions, the postsync.d hooks will be called only once,
+# and they will not be passed any parameters.
+# On a repo.postsync.d hook call, positional parameters contain
+# information about the just-synced repository.
+# Your hook can control it's actions depending on any of the three
+# parameters passed in to it.
+# They are as follows:
+# The repository name.
+# The URI to which the repository was synced.
+# The path to the repository.
+# Portage assumes that a hook succeeded if it exits with 0 code. If no
+# explicit exit is done, the exit code is the exit code of last spawned
+# command. Since our script is a bit more complex, we want to control
+# the exit code explicitly.
+if [ -n "${repository_name}" ]; then
+ # Repository name was provided, so we're in a post-repository hook.
+ echo "* In post-repository hook for ${repository_name}"
+ echo "** synced from remote repository ${sync_uri}"
+ echo "** synced into ${repository_path}"
+ # Gentoo comes with pregenerated cache but the other repositories
+ # usually don't. Generate them to improve performance.
+ if [ "${repository_name}" != "gentoo" ]; then
+ if ! egencache --update --repo="${repository_name}" --jobs=4
+ then
+ echo "!!! egencache failed!"
+ ret=1
+ fi
+ fi
+# Return explicit status.
+exit "${ret}"