1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zap_ynh.git synced 2024-09-03 20:36:07 +02:00
This commit is contained in:
Éric Gaspar 2023-11-13 12:00:51 +01:00 committed by Félix Piédallu
parent 0cfad2a85c
commit 8d38050f07
4 changed files with 4 additions and 5 deletions

View file

@ -58,7 +58,7 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
if [ $database == "mysql" ]; then
ynh_print_info --message="Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
else
elif [ $database == "postgresql" ]; then
ynh_print_info --message="Backup of the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
fi

View file

@ -38,7 +38,6 @@ ynh_app_setting_set --app=$app --key=random_string --value=$random_string
# 1 - Zap
ynh_script_progression --message="Setting up Zap source files..."
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
git clone https://codeberg.org/zot-archive/zap.git "$install_dir" --quiet
@ -112,7 +111,7 @@ if [ $database == "mysql" ]; then
ynh_script_progression --message="Creating a MySQL database..."
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $install_dir/install/schema_mysql.sql
else
elif [ $database == "postgresql" ]; then
# Create postgresql database
ynh_script_progression --message="Creating a PostgreSQL database..."
ynh_replace_string --match_string="db_type = 0;" --replace_string="db_type = 1;" --target_file="$config"

View file

@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
# Remove a database if it exists, along with the associated user
if [ $database == "mysql" ]; then
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
else
elif [ $database == "postgresql" ]; then
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
fi

View file

@ -33,7 +33,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
if [ $database == "mysql" ]; then
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
else
elif [ $database == "postgresql" ]; then
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
fi