From 9f7b30459bd53310a5cd6c3433348df95a135628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 5 May 2023 15:45:45 +0200 Subject: [PATCH] remove actions folder --- scripts/actions/create_database | 64 --------------------------------- scripts/actions/remove_database | 51 -------------------------- scripts/actions/sftp | 63 -------------------------------- 3 files changed, 178 deletions(-) delete mode 100755 scripts/actions/create_database delete mode 100755 scripts/actions/remove_database delete mode 100755 scripts/actions/sftp diff --git a/scripts/actions/create_database b/scripts/actions/create_database deleted file mode 100755 index 3013df6..0000000 --- a/scripts/actions/create_database +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -#================================================= -# SPECIFIC ACTION -#================================================= -# REMOVE THE PREVIOUS DATABASE -#================================================= -ynh_script_progression --message="Removing the previous database..." --weight=6 - -if [ $with_mysql -eq 1 ] -then - yunohost app action run $app remove_database -fi - -#================================================= -# CREATE A NEW DATABASE -#================================================= -ynh_script_progression --message="Creating a new database..." --weight=4 - -db_name=$(ynh_sanitize_dbid --db_name=$app) - -# Reuse the previous password if existing -db_pwd=$(grep "pass:" "$install_dir/db_access.txt" | cut -d' ' -f2 2> /dev/null) - -ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd - -echo -e "# MySQL Database - name: ${db_name}\nuser: ${db_name}\npass: ${db_pwd}" > "$final_path/db_access.txt" - -# Update the config of the app -ynh_app_setting_set --app=$app --key=with_mysql --value=1 -ynh_app_setting_set --app=$app --key=db_name --value=$db_name - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/remove_database b/scripts/actions/remove_database deleted file mode 100755 index 5677093..0000000 --- a/scripts/actions/remove_database +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -if [ $with_mysql -eq 0 ] -then - ynh_die --message="There's no database to remove." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# REMOVE THE DATABASE -#================================================= -ynh_script_progression --message="Removing the database..." --weight=9 - -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - -# Update the config of the app -ynh_app_setting_set --app=$app --key=with_mysql --value=0 - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last diff --git a/scripts/actions/sftp b/scripts/actions/sftp deleted file mode 100755 index 13c8d5b..0000000 --- a/scripts/actions/sftp +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source scripts/_common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -with_sftp=${YNH_ACTION_WITH_SFTP} - -#================================================= -# CHECK IF ARGUMENTS ARE CORRECT -#================================================= - -#================================================= -# CHECK IF AN ACTION HAS TO BE DONE -#================================================= - -with_sftp_old=$(ynh_app_setting_get --app=$app --key=with_sftp) - -if [ $with_sftp -eq $with_sftp_old ] -then - ynh_die --message="with_sftp is already set as $with_sftp." --ret_code=0 -fi - -#================================================= -# SPECIFIC ACTION -#================================================= -# MOVE TO PUBLIC OR PRIVATE -#================================================= - -if [ $with_sftp -eq 1 ] -then - ynh_script_progression --message="Configuring SSH to add a SFTP access..." --weight=3 - - ynh_add_config --template="conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" - -else - ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3 - - # Remove regen-conf hook - ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" -fi - -yunohost tools regen-conf ssh - -# Update the config of the app -ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Execution completed" --last