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

Merge branch 'testing' into v2_PostgreSQL

This commit is contained in:
Éric Gaspar 2024-03-09 19:33:29 +01:00
commit 8416531d6e
4 changed files with 2 additions and 41 deletions

View file

@ -5,7 +5,7 @@ name = "Nextcloud"
description.en = "Online storage, file sharing platform and various other applications" description.en = "Online storage, file sharing platform and various other applications"
description.fr = "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" description.fr = "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications"
version = "28.0.3~ynh2" version = "28.0.3~ynh3"
maintainers = ["kay0u"] maintainers = ["kay0u"]

View file

@ -40,45 +40,6 @@ is_url_handled() {
fi fi
} }
#=================================================
# Check available space before creating a temp directory.
#
# usage: ynh_smart_mktemp --min_size="Min size"
#
# | arg: -s, --min_size= - Minimal size needed for the temporary directory, in Mb
ynh_smart_mktemp () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [s]=min_size= )
local min_size
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
min_size="${min_size:-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
else
ynh_die "Insufficient free space to continue..."
fi
echo "$(mktemp --directory --tmpdir="$tmpdir")"
}
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -184,7 +184,7 @@ then
fi fi
# Create a temporary directory # Create a temporary directory
tmpdir="$(ynh_smart_mktemp min_size=300)" tmpdir="${install_dir}__tmp_upgrade"
ynh_setup_source --dest_dir="$tmpdir" --source_id="$source_id" ynh_setup_source --dest_dir="$tmpdir" --source_id="$source_id"