Skip to content

Commit 9681cd4

Browse files
committed
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 <[email protected]>
1 parent 935d201 commit 9681cd4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkgdiff-mg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ fn2=${2##*/}
3636
ver1=$(patom -F '%{fullver}' "=${cat1}/${fn1%.ebuild}")
3737
ver2=$(patom -F '%{fullver}' "=${cat2}/${fn2%.ebuild}")
3838

39-
export PORTAGE_TMPDIR="${TMPDIR:-/tmp}"/mgorny-dev-scripts
39+
DEFAULT_TMPDIR=/tmp
40+
if [[ -d /run/systemd/system ]]; then
41+
# System booted via systemd, which automatically cleans up stale
42+
# files in /var/tmp.
43+
DEFAULT_TMPDIR=/var/tmp
44+
fi
45+
export PORTAGE_TMPDIR="${TMPDIR:-${DEFAULT_TMPDIR}}"/mgorny-dev-scripts
4046
export USE="${USE} test"
4147
# use noauto to skip pkg_setup
4248
export FEATURES="${FEATURES} noauto"

0 commit comments

Comments
 (0)