1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/my_webapp_ynh.git synced 2024-09-03 19:46:26 +02:00

remove actions folder

This commit is contained in:
Éric Gaspar 2023-05-05 15:45:45 +02:00
parent 9e3097c524
commit 9f7b30459b
3 changed files with 0 additions and 178 deletions

View file

@ -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

View file

@ -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

View file

@ -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