From a348c94d6797726747211555b89b87d4d96426b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Martin?= Date: Thu, 21 Feb 2019 18:24:14 +0100 Subject: [PATCH] Revert "Add a new helper to create temporary directory" This reverts commit 660f14cb47b4fa9b4fbcb604aff2a63982a72ac8. --- scripts/_common.sh | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 77b2812..7ce131e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -356,27 +356,3 @@ ynh_multimedia_addaccess () { groupadd -f multimedia usermod -a -G multimedia $user_name } - -ynh_smart_mktemp () { - local min_size="${1:-300}" - # Transform the minimum size from megabytes to kilobytes - min_size=$(( $min_size * 1024 )) - - # Check if there's enough free space in a directory - is_there_enough_space () { - local free_space=$(df --output=avail "$1" | sed 1d) - test $free_space -ge $min_size - } - - if is_there_enough_space /tmp; then - local tmpdir=/tmp - elif is_there_enough_space /var; then - local tmpdir=/var - elif is_there_enough_space /; then - local tmpdir=/ - elif is_there_enough_space /home; then - local tmpdir=/home - fi - - echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" -}