mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers2.1: fixes after tests on the battlefield
This commit is contained in:
parent
d501131b34
commit
50a4d08add
6 changed files with 8 additions and 29 deletions
|
@ -11,7 +11,7 @@ set +x
|
|||
|
||||
YNH_HELPERS_DIR="$SCRIPT_DIR/helpers.v${YNH_HELPERS_VERSION}.d"
|
||||
case "$YNH_HELPERS_VERSION" in
|
||||
"1" | "2")
|
||||
"1" | "2" | "2.1")
|
||||
readarray -t HELPERS < <(find -L "$YNH_HELPERS_DIR" -mindepth 1 -maxdepth 1 -type f)
|
||||
for helper in "${HELPERS[@]}"; do
|
||||
[ -r "$helper" ] && source "$helper"
|
||||
|
|
|
@ -234,7 +234,7 @@ ynh_install_app_dependencies() {
|
|||
dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')"
|
||||
local dependencies=${dependencies//|/ | }
|
||||
|
||||
local version=$(ynh_read_manifest --manifest_key="version")
|
||||
local version=$(ynh_read_manifest "version")
|
||||
if [ -z "${version}" ] || [ "$version" == "null" ]; then
|
||||
version="1.0"
|
||||
fi
|
||||
|
|
|
@ -217,7 +217,7 @@ ynh_get_scalable_phpfpm() {
|
|||
fi
|
||||
|
||||
# Get the total of RAM available, except swap.
|
||||
local max_ram=$(ynh_get_ram --total --ignore_swap)
|
||||
local max_ram=$(ynh_get_ram --total)
|
||||
|
||||
at_least_one() {
|
||||
# Do not allow value below 1
|
||||
|
@ -267,28 +267,6 @@ ynh_get_scalable_phpfpm() {
|
|||
php_max_spare_servers=0
|
||||
php_start_servers=0
|
||||
fi
|
||||
|
||||
if [ $print -eq 1 ]; then
|
||||
ynh_print_warn --message="Footprint=${footprint}Mb by pool."
|
||||
ynh_print_warn --message="Process manager=$php_pm"
|
||||
ynh_print_warn --message="Max RAM=${max_ram}Mb"
|
||||
if [ "$php_pm" != "static" ]; then
|
||||
ynh_print_warn --message="\nMax estimated footprint=$(($php_max_children * $footprint))"
|
||||
ynh_print_warn --message="Min estimated footprint=$(($php_min_spare_servers * $footprint))"
|
||||
fi
|
||||
if [ "$php_pm" = "dynamic" ]; then
|
||||
ynh_print_warn --message="Estimated average footprint=$(($php_max_spare_servers * $footprint))"
|
||||
elif [ "$php_pm" = "static" ]; then
|
||||
ynh_print_warn --message="Estimated footprint=$(($php_max_children * $footprint))"
|
||||
fi
|
||||
ynh_print_warn --message="\nRaw php-fpm values:"
|
||||
ynh_print_warn --message="pm.max_children = $php_max_children"
|
||||
if [ "$php_pm" = "dynamic" ]; then
|
||||
ynh_print_warn --message="pm.start_servers = $php_start_servers"
|
||||
ynh_print_warn --message="pm.min_spare_servers = $php_min_spare_servers"
|
||||
ynh_print_warn --message="pm.max_spare_servers = $php_max_spare_servers"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute a command with Composer
|
||||
|
@ -342,7 +320,7 @@ ynh_install_composer() {
|
|||
# because local always return 0 ...
|
||||
local out
|
||||
# Timeout option is here to enforce the timeout on dns query and tcp connect (c.f. man wget)
|
||||
out=$(wget --tries 3 --no-dns-cache --timeout 900 --no-verbose --output-document=$workdir $composer_url 2>&1) \
|
||||
out=$(wget --tries 3 --no-dns-cache --timeout 900 --no-verbose --output-document=$workdir/composer.phar $composer_url 2>&1) \
|
||||
|| ynh_die --message="$out"
|
||||
|
||||
# install dependencies
|
||||
|
|
|
@ -38,7 +38,7 @@ ynh_string_random() {
|
|||
# Requires YunoHost version 2.6.4 or higher.
|
||||
ynh_replace() {
|
||||
# ============ Argument parsing =============
|
||||
local -A args_array=([m]=match= [r]=replaceg= [f]=file=)
|
||||
local -A args_array=([m]=match= [r]=replace= [f]=file=)
|
||||
local match
|
||||
local replace
|
||||
local file
|
||||
|
|
|
@ -388,7 +388,7 @@ ynh_local_curl() {
|
|||
chmod 700 $cookiefile
|
||||
|
||||
# Temporarily enable visitors if needed...
|
||||
local visitors_enabled=$(ynh_permission_has_user "main" "visitors" && echo yes || echo no)
|
||||
local visitors_enabled=$(ynh_permission_has_user --permission="main" --user="visitors" && echo yes || echo no)
|
||||
if [[ $visitors_enabled == "no" ]]; then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
@ -456,7 +456,7 @@ ynh_safe_rm() {
|
|||
#
|
||||
# Requires YunoHost version 3.5.0 or higher.
|
||||
ynh_read_manifest() {
|
||||
cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq ".$manifest_key" --raw-output
|
||||
cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq "$1" --raw-output
|
||||
}
|
||||
|
||||
# Return the app upstream version, deduced from `$YNH_APP_MANIFEST_VERSION` and strippig the `~ynhX` part
|
||||
|
|
1
helpers/helpers.v2.1.d/vendor
Symbolic link
1
helpers/helpers.v2.1.d/vendor
Symbolic link
|
@ -0,0 +1 @@
|
|||
../vendor
|
Loading…
Add table
Reference in a new issue