Skip to content

Commit 815b442

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 153fafa commit 815b442

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkgdiff-mg

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ cat2=$(get_category "${2}")
3232
fn1=${1##*/}
3333
fn2=${2##*/}
3434

35-
export PORTAGE_TMPDIR="${TMPDIR:-/tmp}"/mgorny-dev-scripts
35+
DEFAULT_TMPDIR=/tmp
36+
PID_ONE=$(ps --no-headers -o comm 1)
37+
if [[ "${PID_ONE}" == systemd ]]; then
38+
DEFAULT_TMPDIR=/var/tmp
39+
fi
40+
export PORTAGE_TMPDIR="${TMPDIR:-${DEFAULT_TMPDIR}}"/mgorny-dev-scripts
3641
export USE="${USE} test"
3742
mkdir -p "${PORTAGE_TMPDIR}"
3843
ebuild "${1}" unpack

0 commit comments

Comments
 (0)