1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

Revert "Add a new helper to create temporary directory"

This reverts commit 660f14cb47.
This commit is contained in:
Mickaël Martin 2019-02-21 18:24:14 +01:00
parent f33d324f3f
commit a348c94d67

View file

@ -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")"
}