From 6f206e55a97c9fc89b347c692c3337eda025dfd8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 21 Nov 2021 17:18:42 +0100 Subject: [PATCH] Fix --- manifest.json | 28 ++++++++++++++-------------- scripts/_common.sh | 36 ------------------------------------ 2 files changed, 14 insertions(+), 50 deletions(-) diff --git a/manifest.json b/manifest.json index 6ce469d..6032f75 100644 --- a/manifest.json +++ b/manifest.json @@ -24,21 +24,21 @@ ], "arguments": { "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/ttrss", - "default": "/ttrss" + { + "name": "domain", + "type": "domain" }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, + { + "name": "path", + "type": "path", + "example": "/ttrss", + "default": "/ttrss" + }, + { + "name": "is_public", + "type": "boolean", + "default": true + } ] } } diff --git a/scripts/_common.sh b/scripts/_common.sh index ecd3576..d77187a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -13,39 +13,3 @@ pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YN # EXPERIMENTAL HELPERS #================================================= -# 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")" -}