2018-07-21 19:42:17 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS
|
|
|
|
#=================================================
|
2019-01-30 16:07:38 +01:00
|
|
|
ynh_script_progression --message="Retrieve arguments from the manifest"
|
2018-07-21 19:42:17 +02:00
|
|
|
|
2018-09-30 20:01:19 +02:00
|
|
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
2018-07-21 19:42:17 +02:00
|
|
|
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF ARGUMENTS ARE CORRECT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF AN ACTION HAS TO BE DONE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC ACTION
|
|
|
|
#=================================================
|
|
|
|
# CLEAN ALL BACKUP FILES
|
|
|
|
#=================================================
|
2019-01-30 16:07:38 +01:00
|
|
|
ynh_script_progression --message="Clean all backup files" --weight=9
|
2018-07-21 19:42:17 +02:00
|
|
|
|
|
|
|
# Get the backup directory from the config file
|
|
|
|
backup_dir="$(grep "^backup_dir=" "$final_path/Backup_list.conf" | cut -d= -f2)"
|
|
|
|
|
|
|
|
while read directory <&3
|
|
|
|
do
|
|
|
|
if [ -n "$directory" ]
|
|
|
|
then
|
|
|
|
ynh_print_info "Clean backup directory $directory" >&2
|
|
|
|
ynh_secure_remove "$directory"
|
|
|
|
fi
|
|
|
|
done 3<<< $(find "$backup_dir" -maxdepth 1 -mindepth 1 -type d)
|
2019-01-30 16:07:38 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Execution completed" --last
|