1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/osada_ynh.git synced 2024-09-03 19:46:30 +02:00
This commit is contained in:
ericgaspar 2021-09-12 15:33:21 +02:00
parent 1d50f1941d
commit 82b10292c3
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 22 additions and 33 deletions

View file

@ -13,10 +13,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -55,22 +51,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP OF THE DATABASE
#=================================================
if [ $database -eq 1 ]; then
# Backup MySQL database
ynh_print_info --message="Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
elif [ $database -eq 2 ]; then
# Backup PostgreSQL database
ynh_print_info --message="Backup of the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
fi
#=================================================
# SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
@ -90,6 +70,20 @@ ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP OF THE DATABASE
#=================================================
if [ $database -eq 1 ]; then
# Backup MySQL database
ynh_print_info --message="Backup of the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
elif [ $database -eq 2 ]; then
# Backup PostgreSQL database
ynh_print_info --message="Backup of the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -13,10 +13,6 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -122,7 +118,6 @@ pushd "$final_path"
ln -s ../extend/addon/zaddons/$base $base ln -s ../extend/addon/zaddons/$base $base
done done
popd popd

View file

@ -77,7 +77,7 @@ ynh_setup_source --dest_dir="$final_path"
# cp -a "$tmpdir/.htconfig.php" "${final_path}" # cp -a "$tmpdir/.htconfig.php" "${final_path}"
# cp -a "$tmpdir/php.log" "${final_path}" # cp -a "$tmpdir/php.log" "${final_path}"
# ynh_secure_remove "$tmpdir" # ynh_secure_remove "$tmpdir"
# chmod -R 777 $final_path/store # chmod -R 775 $final_path/store
# mkdir $final_path/addon # mkdir $final_path/addon
# ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" # ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
@ -115,7 +115,7 @@ if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
fi; fi;
done done
popd popd
chmod -R 777 $final_path/store chmod -R 775 $final_path/store
else else
# Create a temporary directory # Create a temporary directory
@ -137,7 +137,7 @@ else
cp -a "$tmpdir/.htconfig.php" "${final_path}" cp -a "$tmpdir/.htconfig.php" "${final_path}"
cp -a "$tmpdir/php.log" "${final_path}" cp -a "$tmpdir/php.log" "${final_path}"
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$tmpdir"
chmod -R 777 $final_path/store chmod -R 775 $final_path/store
mkdir $final_path/addon mkdir $final_path/addon
ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons" ynh_setup_source --dest_dir="$final_path/addon" --source_id="app_addons"
fi fi