logo

etc_portage

Unnamed repository; edit this file 'description' to name the repository. git clone https://hacktivis.me/git/etc_portage.git

example (2303B)


  1. #!/bin/bash
  2. # Example /etc/portage/repo.postsync.d script. Make it executable (chmod +x) for
  3. # Portage to process it.
  4. #
  5. # With portage-2.2.16 and newer, all repo.postsync.d hooks will be called multiple
  6. # times after syncing each repository.
  7. #
  8. # Older versions of Portage support syncing only one repository.
  9. # In those versions, the postsync.d hooks will be called only once,
  10. # and they will not be passed any parameters.
  11. # On a repo.postsync.d hook call, positional parameters contain
  12. # information about the just-synced repository.
  13. # Your hook can control it's actions depending on any of the three
  14. # parameters passed in to it.
  15. #
  16. # They are as follows:
  17. #
  18. # The repository name.
  19. repository_name=${1}
  20. # The URI to which the repository was synced.
  21. sync_uri=${2}
  22. # The path to the repository.
  23. repository_path=${3}
  24. # Portage assumes that a hook succeeded if it exits with 0 code. If no
  25. # explicit exit is done, the exit code is the exit code of last spawned
  26. # command. Since our script is a bit more complex, we want to control
  27. # the exit code explicitly.
  28. ret=0
  29. if [ -n "${repository_name}" ]; then
  30. # Repository name was provided, so we're in a post-repository hook.
  31. echo "* In post-repository hook for ${repository_name}"
  32. echo "** synced from remote repository ${sync_uri}"
  33. echo "** synced into ${repository_path}"
  34. # Gentoo comes with pregenerated cache but the other repositories
  35. # usually don't. Generate them to improve performance.
  36. if [ "${repository_name}" != "gentoo" ]; then
  37. if ! egencache --update --repo="${repository_name}" --jobs=4
  38. then
  39. echo "!!! egencache failed!"
  40. ret=1
  41. fi
  42. fi
  43. fi
  44. if [ -n "${repository_name}" ] && ! [ -e "${repository_path}/metadata/pkg_desc_index" ]; then
  45. # Regenerate the metadata/pkg_desc_index file. This is not
  46. # needed for https://gitweb.gentoo.org/repo/sync/gentoo.git which
  47. # provides a freshly generated copy. The --external-cache-only
  48. # option causes the metadata/pkg_desc_index file to be written under
  49. # /var/cache/edb/dep instead of the repository itself, so that it
  50. # does not interfere with repository verification.
  51. if ! egencache --update-pkg-desc-index --external-cache-only --repo="${repository_name}" ${PORTAGE_VERBOSE+--verbose}
  52. then
  53. echo "!!! egencache failed!"
  54. ret=1
  55. fi
  56. fi
  57. # Return explicit status.
  58. exit "${ret}"