From 9681cd49bfc0e53f3d21f9946d15f757f364abd8 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 27 May 2023 13:06:44 +0200 Subject: [PATCH] pkgdiff-mg: under systemd use /var/tmp as default TMPDIR pkgdiff can cause large files in the used temprorary directory that are not cleaned up on exit. Using /tmp for those, which is often a tmpfs, which means that the files consume main memory at first. Later the system may move the unused files on the tmpfs into swap. Under systemd, using /var/tmp for files that are not deleted by the creator, which is pkgdiff-mg in our case, is safe, since systemd will automatically delete old unused files from /var/tmp. Signed-off-by: Florian Schmaus --- pkgdiff-mg | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgdiff-mg b/pkgdiff-mg index 9894dda..065a969 100755 --- a/pkgdiff-mg +++ b/pkgdiff-mg @@ -36,7 +36,13 @@ fn2=${2##*/} ver1=$(patom -F '%{fullver}' "=${cat1}/${fn1%.ebuild}") ver2=$(patom -F '%{fullver}' "=${cat2}/${fn2%.ebuild}") -export PORTAGE_TMPDIR="${TMPDIR:-/tmp}"/mgorny-dev-scripts +DEFAULT_TMPDIR=/tmp +if [[ -d /run/systemd/system ]]; then + # System booted via systemd, which automatically cleans up stale + # files in /var/tmp. + DEFAULT_TMPDIR=/var/tmp +fi +export PORTAGE_TMPDIR="${TMPDIR:-${DEFAULT_TMPDIR}}"/mgorny-dev-scripts export USE="${USE} test" # use noauto to skip pkg_setup export FEATURES="${FEATURES} noauto"