1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00
friendica_ynh/scripts/_common.sh

49 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
2020-04-09 10:42:49 +02:00
#=================================================
# COMMON VARIABLES
#=================================================
# commit hashes
# 2021.04
version_commit="6434d018c89a880bd667dc7d9185e6a7b16f0718"
addons_version_commit="47bc4a97f7a5a0ce372c273f5e8123f64ee74313"
2020-04-09 10:42:49 +02:00
# dependencies used by the app
2020-10-15 21:09:24 +02:00
YNH_PHP_VERSION="7.3"
2021-02-03 19:50:12 +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}-mysql php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd"
2021-07-01 22:14:37 +02:00
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
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
2021-07-12 23:16:17 +02:00
elif is_there_enough_space /; then
2021-07-01 22:14:37 +02:00
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
#=================================================