diff --git a/conf/config.php b/conf/config.php index 49ef0ad..2a097d3 100644 --- a/conf/config.php +++ b/conf/config.php @@ -183,7 +183,7 @@ define('REVERSE_PROXY_AUTH', true); define('REVERSE_PROXY_USER_HEADER', 'REMOTE_USER'); // Username of the admin, by default blank -define('REVERSE_PROXY_DEFAULT_ADMIN', '__USER__'); +define('REVERSE_PROXY_DEFAULT_ADMIN', '__ADMIN__'); // Default domain to use for setting the email address define('REVERSE_PROXY_DEFAULT_DOMAIN', '__DOMAIN__'); diff --git a/manifest.json b/manifest.json index 6c012c3..55b259d 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "previous_maintainers": [{ "name": "mbugeia", @@ -27,7 +27,7 @@ "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { diff --git a/scripts/install b/scripts/install index 5ca045b..c7f2713 100644 --- a/scripts/install +++ b/scripts/install @@ -23,6 +23,7 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +email=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -45,7 +46,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=adminusername --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -101,18 +101,10 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Configuring Kanboard..." -# Retrieve admin email -email=$(ynh_user_get_info --username=$admin --key=mail) - # Copy and edit config.php -config_php="${final_path}/config.php" +config_php="$final_path/config.php" -cp ../conf/config.php "$config_php" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_php" -ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$config_php" -ynh_replace_string --match_string="__USER__" --replace_string=$admin --target_file="$config_php" -ynh_replace_string --match_string="__EMAIL__" --replace_string=$email --target_file="$config_php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$config_php" +ynh_add_config --template="../conf/config.php" --destination="$config_php" #================================================= # DATABASE INITIALIZATION @@ -120,11 +112,11 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --targ ynh_script_progression --message="Initializing database..." --weight=7 ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < "${final_path}/app/Schema/Sql/mysql.sql" -( - cd "$final_path" + +pushd $final_path # Launch database migration - php$YNH_PHP_VERSION cli db:migrate --no-interaction --verbose -) + php$phpversion cli db:migrate --no-interaction --verbose +popd #================================================= # GENERIC FINALIZATION @@ -147,12 +139,10 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex #================================================= # SETUP CRON #================================================= -ynh_script_progression --message="Setuping a cron..." +ynh_script_progression --message="Setuping a cron..." --weight=1 + +ynh_add_config --template="../conf/cron_kanboard" --destination="$/etc/cron.d/$app" -cp ../conf/cron_kanboard /etc/cron.d/$app -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" -ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" #================================================= @@ -178,7 +168,7 @@ ynh_store_file_checksum --file="$config_php" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 22f3485..e4a37dd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,9 @@ admin=$(ynh_app_setting_get --app=$app --key=adminusername) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= # CHECK VERSION @@ -117,34 +119,24 @@ ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= ynh_script_progression --message="Reconfiguring Kanboard..." --weight=2 -# Retrieve admin email -email=$(ynh_user_get_info --username=$admin --key=mail) - # Copy and edit config.php -config_php="${final_path}/config.php" +config_php="$final_path/config.php" ynh_backup_if_checksum_is_different --file="$config_php" -cp ../conf/config.php "$config_php" -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_php" -ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$config_php" -ynh_replace_string --match_string="__USER__" --replace_string=$admin --target_file="$config_php" -ynh_replace_string --match_string="__EMAIL__" --replace_string=$email --target_file="$config_php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$config_php" +ynh_add_config --template="../conf/config.php" --destination="$config_php" #================================================= # UPGRADE KANBOARD #================================================= ynh_script_progression --message="Upgrading Kanboard..." --weight=2 -( - cd "$final_path" +pushd $final_path # Launch database migration - php$YNH_PHP_VERSION cli db:migrate --no-interaction --verbose + php$phpversion cli db:migrate --no-interaction --verbose # Launch plugins migration - php$YNH_PHP_VERSION cli plugin:upgrade --no-interaction --verbose -) + php$phpversion cli plugin:upgrade --no-interaction --verbose +popd #================================================= # GENERIC FINALIZATION @@ -169,10 +161,8 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex #================================================= ynh_script_progression --message="Setuping a cron..." -cp ../conf/cron_kanboard /etc/cron.d/$app -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" -ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" +ynh_add_config --template="../conf/cron_kanboard" --destination="$/etc/cron.d/$app" + chmod 644 "/etc/cron.d/$app" #=================================================