From 8ddc800166d72e9319ad1f6b4dd1f8ba31daf338 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 18 Apr 2023 14:00:42 -0400 Subject: [PATCH] Userdata backup function --- functions.sh | 4 ++++ tools/configurator.sh | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/functions.sh b/functions.sh index fafee186..00cc0dbe 100644 --- a/functions.sh +++ b/functions.sh @@ -1677,6 +1677,10 @@ update_rpcs3_firmware() { rm -rf "$roms_folder/ps3/tmp" } +backup_retrodeck_userdata() { + zip -rq9 "$backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip" "$saves_folder" "$states_folder" "$bios_folder" "$media_folder" "$themes_folder" "$logs_folder" "$screenshots_folder" "$mods_folder" "$texture_packs_folder" "$borders_folder" > $logs_folder/$(date +"%0m%0d")_backup_log.log +} + create_lock() { # creating RetroDECK's lock file and writing the version in the config file version=$hard_version diff --git a/tools/configurator.sh b/tools/configurator.sh index 178ee728..c4908e57 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -38,6 +38,7 @@ source /app/libexec/functions.sh # - Multi-file compression (CHD) # - Download ES themes # - Download PS3 firmware +# - Backup RetroDECK userdata # - Reset # - Reset Specific Emulator # - Reset RetroArch @@ -753,7 +754,8 @@ configurator_tools_and_troubleshooting_dialog() { "Advanced BIOS file check" "Show advanced information about common BIOS files" \ "Compress Games" "Compress games to CHD format for systems that support it" \ "Download/Update Themes" "Download new themes for RetroDECK or update existing ones" \ - "Download PS3 Firmware" "Download PS3 firmware for use with the RPCS3 emulator" ) + "Download PS3 Firmware" "Download PS3 firmware for use with the RPCS3 emulator" \ + "Backup RetroDECK Userdata" "Compress important RetroDECK user data folders" ) case $choice in @@ -796,6 +798,23 @@ configurator_tools_and_troubleshooting_dialog() { fi ;; + "Backup RetroDECK Userdata" ) + configurator_generic_dialog "This tool will compress important RetroDECK userdata (basically everything except the ROMs folder) into a zip file.\n\nThis process can take several minutes, and the resulting zip file can be found in the ~/retrodeck/backups folder." + ( + backup_retrodeck_userdata + ) | + zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Configurator Utility - Backup in Progress" \ + --text="Backing up RetroDECK userdata, please wait..." + if [[ -f $backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip ]]; then + configurator_generic_dialog "The backup process is now complete." + else + configurator_generic_dialog "The backup process could not be completed,\nplease check the logs folder for more information." + fi + configurator_tools_and_troubleshooting_dialog + ;; + "" ) # No selection made or Back button clicked configurator_welcome_dialog ;;