From f7a6d6ca2dbbd39f20d299478c28f92e83f6f53c Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 19 Oct 2017 21:06:34 +0200 Subject: [PATCH] Take more official review comments into account --- scripts/install | 13 ++++++------- scripts/remove | 1 - scripts/upgrade | 19 +++++++++---------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index a84bb03..6b64b49 100644 --- a/scripts/install +++ b/scripts/install @@ -85,12 +85,12 @@ ynh_mysql_setup_db "$db_user" "$db_name" ynh_app_setting_set $app final_path "$final_path" # Create tmp directory and fetch app inside -TMPDIR=$(mktemp -d) -ynh_setup_source "$TMPDIR" +tmpdir=$(mktemp -d) +ynh_setup_source "$tmpdir" # Fetch needed plugins -mkdir -p $TMPDIR/plugins/Ldap_Login -ynh_setup_source "$TMPDIR/plugins/Ldap_Login" ldap_plugin -ynh_setup_source "$TMPDIR/plugins" log_failed_logins_plugin +mkdir -p $tmpdir/plugins/Ldap_Login +ynh_setup_source "$tmpdir/plugins/Ldap_Login" ldap_plugin +ynh_setup_source "$tmpdir/plugins" log_failed_logins_plugin #================================================= # CREATE DEDICATED USER @@ -104,7 +104,7 @@ ynh_system_user_create $app # Create a dedicated system user # Install files and set permissions mkdir $final_path -cp -a $TMPDIR/!(upload|_data) $final_path +cp -a $tmpdir/!(upload|_data) $final_path datapath=/home/yunohost.app/$app mkdir -p $datapath/_data @@ -122,7 +122,6 @@ chmod 755 -R $final_path/_data #================================================= ynh_add_nginx_config -ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf" # Copy and set php-fpm configuration ynh_add_fpm_config diff --git a/scripts/remove b/scripts/remove index b9cb134..6106ac3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) -domain=$(ynh_app_setting_get "$app" domain) #================================================= # STANDARD REMOVE diff --git a/scripts/upgrade b/scripts/upgrade index 62b0424..40d0016 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,9 +19,9 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME # Check destination directory -DESTDIR="/var/www/$app" -[[ ! -d $DESTDIR ]] && ynh_die \ -"The destination directory '$DESTDIR' does not exist.\ +destdir="/var/www/$app" +[[ ! -d $destdir ]] && ynh_die \ +"The destination directory '$destdir' does not exist.\ The app is not correctly installed, you should remove it first." # Retrieve arguments @@ -105,12 +105,12 @@ ynh_install_app_dependencies "$pkg_dependencies" #================================================= # Create tmp directory and fetch app inside -TMPDIR=$(ynh_mkdir_tmp) -ynh_setup_source "$TMPDIR" +tmpdir=$(ynh_mkdir_tmp) +ynh_setup_source "$tmpdir" # Fetch needed plugins -mkdir -p $TMPDIR/plugins/Ldap_Login -ynh_setup_source "$TMPDIR/plugins/Ldap_Login" ldap_plugin -ynh_setup_source "$TMPDIR/plugins" log_failed_logins_plugin +mkdir -p $tmpdir/plugins/Ldap_Login +ynh_setup_source "$tmpdir/plugins/Ldap_Login" ldap_plugin +ynh_setup_source "$tmpdir/plugins" log_failed_logins_plugin #================================================= # CREATE DEDICATED USER @@ -135,7 +135,7 @@ if [ -h $final_path/galleries ] ; then fi # Install files and set permissions -cp -a $TMPDIR/!(upload|_data) $final_path +cp -a $tmpdir/!(upload|_data) $final_path # Backward compatibility: @@ -214,5 +214,4 @@ fi #================================================= # RELOAD NGINX #================================================= -systemctl restart php5-fpm systemctl reload nginx \ No newline at end of file