summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-08-22 23:30:51 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-08-22 23:30:51 +0100
commit616aad8ecb790519e51ea987a934c527edf91395 (patch)
tree0f115b4c9185bc542f2d42390d90ec85ea1299ea
parentfa2cd0a78cb76fda8975b33af9abecfeebef7ab4 (diff)
fix : package cache is always saved and eats up all available disc space during large upgrades
-rw-r--r--conf/intel/portage/bashrc24
1 files changed, 24 insertions, 0 deletions
diff --git a/conf/intel/portage/bashrc b/conf/intel/portage/bashrc
new file mode 100644
index 0000000..e11ca1c
--- /dev/null
+++ b/conf/intel/portage/bashrc
@@ -0,0 +1,24 @@
+pkg_postinst() {
+ # By default, binary mode portage downloads binary packages from repository and saves
+ # them in /usr/portage/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 /usr/portage/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 /usr/portage/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
+ # /usr/portage/packages directory (which is the binary package cache).
+
+ # In orther for this to work PORTDIR (/usr/portage) and PKGDIR(/usr/portage/packages)
+ # must be on the same filesystem, which is 99% the case. If they are on different
+ # filesystems, package cache is always saved, as mentioned above.
+
+ export local PORTDIRDEV=$(find /usr/portage -maxdepth 0 -printf "%D")
+ export local PKGDIRDEV=$(find /usr/portage/packages -maxdepth 0 -printf "%D")
+ if [ $PORTDIRDEV = $PKGDIRDEV ]; then
+ rm -rf /usr/portage/packages/*
+ fi
+}