1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shaarli_ynh.git synced 2024-09-03 20:26:10 +02:00
shaarli_ynh/scripts/_common.sh

47 lines
1.4 KiB
Bash
Raw Normal View History

2018-09-27 22:44:34 +02:00
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# dependencies used by the app
YNH_PHP_VERSION="7.3"
# dependencies used by the app
pkg_dependencies="openssl"
extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-gettext php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring"
2017-06-17 12:20:09 +02:00
2018-09-27 22:44:34 +02:00
#=================================================
# PERSONAL HELPERS
2018-09-27 22:44:34 +02:00
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# 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")"
}