summaryrefslogtreecommitdiff
path: root/conf/intel/portage/bashrc
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-02-06 23:49:35 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-02-06 23:49:35 +0000
commitd3688f70dd10e87da7267435e75e75f8645a1a6c (patch)
tree425666f04b133a3745ed96614c7e3f10eb3f5ed5 /conf/intel/portage/bashrc
parent732251a9e57303d1864b8ea917b9930dd3e265a8 (diff)
Revert "with new layout we no longer need this, and will reimplement it as a manual option in sisyphus"
This reverts commit bc47a06ee3e4bb12fa912bb90e52a2e70a615a6a.
Diffstat (limited to 'conf/intel/portage/bashrc')
-rw-r--r--conf/intel/portage/bashrc30
1 files changed, 30 insertions, 0 deletions
diff --git a/conf/intel/portage/bashrc b/conf/intel/portage/bashrc
new file mode 100644
index 0000000..f5f8109
--- /dev/null
+++ b/conf/intel/portage/bashrc
@@ -0,0 +1,30 @@
+# This file has been automatically generated, do not edit.
+
+cleancache() {
+ # By default, binary mode portage downloads binary packages from repository and saves
+ # them in /var/cache/packages. This saves bandwidth in case of reinstalls/downgrades,
+ # but will eat up lots of HDD space, possibly preventing further installs/upgrades.
+
+ # To address this issue, we check if /var/cache/packages directory is on its own partition
+ # case in which we do nothing assuming that user gave it plenty space anyway. But if its
+ # not the case, and /var/cache/packages is just a directory in the system / root hierarchy,
+ # then we make sure we remove downloaded binary packages after every installation.
+
+ # This function hooks into the pkg_postinst() phase, after the package files are written
+ # into the filesystem and registered into the database, and just removes the content of
+ # /var/cache/packages directory (which is the binary package cache).
+
+ export local PORTDIRDEV=$(find /var/cache -maxdepth 0 -printf "%D")
+ export local PKGDIRDEV=$(find /var/cache/packages -maxdepth 0 -printf "%D")
+ if [ $PORTDIRDEV = $PKGDIRDEV ] ; then
+ rm -rf /var/cache/packages/"${CATEGORY}"/"${P}"*.tbz2
+ fi
+}
+
+main() {
+ if [ "${EBUILD_PHASE}" == "postinst" ]; then
+ cleancache
+ fi
+}
+
+main