2018-04-30 20:24:17 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-04-04 18:32:01 +02:00
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# dependencies used by the app
|
2020-10-14 04:28:54 +02:00
|
|
|
YNH_PHP_VERSION="7.3"
|
|
|
|
|
2020-12-07 13:53:19 +01:00
|
|
|
extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd"
|
2020-11-13 11:25:58 +01:00
|
|
|
|
2020-10-14 04:28:54 +02:00
|
|
|
# dependencies used by the app
|
|
|
|
pkg_dependencies="postgresql postgresql-contrib"
|
2019-04-04 18:32:01 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
2018-11-08 11:08:11 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2019-04-08 11:33:50 +02:00
|
|
|
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
|
2020-10-14 04:28:54 +02:00
|
|
|
local tmpdir=/
|
2019-04-08 11:33:50 +02:00
|
|
|
elif is_there_enough_space /home; then
|
|
|
|
local tmpdir=/home
|
|
|
|
else
|
|
|
|
ynh_die "Insufficient free space to continue..."
|
|
|
|
fi
|
|
|
|
|
2020-11-13 11:25:58 +01:00
|
|
|
echo "$(mktemp --directory --tmpdir="$tmpdir")"
|
2019-04-08 11:33:50 +02:00
|
|
|
}
|
2019-04-04 18:32:01 +02:00
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|