From 8b4a143628d33d1105c45453cd804f3e0cd5b2d3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 17 Jul 2021 17:18:53 +0200 Subject: [PATCH] Fix --- scripts/_common.sh | 25 ------------------------- scripts/install | 12 ++++++------ scripts/upgrade | 2 +- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b8749f1..bb74e80 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -13,31 +13,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli # 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 - elif is_there_enough_space /; then1 - 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 #================================================= diff --git a/scripts/install b/scripts/install index e3d7994..561457a 100644 --- a/scripts/install +++ b/scripts/install @@ -29,8 +29,6 @@ domain=$YNH_APP_ARG_DOMAIN path_url='/' admin=$YNH_APP_ARG_ADMIN email=$(ynh_user_get_info --username=$admin --key=mail) -is_public=1 -database="1" app=$YNH_APP_INSTANCE_NAME @@ -54,7 +52,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=email --value=$email -ynh_app_setting_set --app=$app --key=database --value=$database #================================================= # CREATE DEDICATED USER @@ -81,13 +78,13 @@ ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # 1- Clone stable repo -git clone https://github.com/friendica/friendica.git -b stable "$final_path" +ynh_exec_warn_less git clone https://github.com/friendica/friendica.git -b stable "$final_path" # Copy .htaccess-dist to ..htaccess cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess" # 2 - Clone addons repo -git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" +ynh_exec_warn_less git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon" chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -101,7 +98,10 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated nginx config ynh_add_nginx_config - +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php" diff --git a/scripts/upgrade b/scripts/upgrade index ace4c7b..b15207c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,7 +121,7 @@ then else # Create a temporary directory and backup smarty3 folder - tmpdir="$(ynh_smart_mktemp 6000)" + tmpdir="$(mktemp -d)" ynh_script_progression --message="Upgrading source files..." cp -a "$final_path/view/smarty3" "$tmpdir/view/smarty3"