POST_UPDATE: nasking the users to move the ES-DE folders

This commit is contained in:
XargonWan 2024-07-24 22:14:51 +09:00
parent 2d1aa229f9
commit a039037bd2

View file

@ -353,25 +353,41 @@ post_update() {
if [[ $(check_version_is_older_than "0.8.3b") == "true" ]]; then if [[ $(check_version_is_older_than "0.8.3b") == "true" ]]; then
# In version 0.8.3b, the following changes were made: # In version 0.8.3b, the following changes were made:
# - Recovery from a failed move of the themes, downloaded_media and gamelists folder to their new ES-DE locations. # - Recovery from a failed move of the themes, downloaded_media and gamelists folder to their new ES-DE locations.
# Check if any of the directories exist
if [ -d "$rdhome/themes" ] || [ -d "$rdhome/downloaded_media" ] || [ -d "$rdhome/gamelists" ] || [ -d "$rdhome/collections" ]; then if [ -d "$rdhome/themes" ] || [ -d "$rdhome/downloaded_media" ] || [ -d "$rdhome/gamelists" ] || [ -d "$rdhome/collections" ]; then
log i "Moving ES-DE downloaded_media, gamelist, and themes from \"$rdhome\" to \"$rdhome/ES-DE\" due to a RetroDECK Framework bug" log i "Moving ES-DE downloaded_media, gamelist, and themes from \"$rdhome\" to \"$rdhome/ES-DE\" due to a RetroDECK Framework bug"
# Ask user if they want to move and overwrite the data
if [[ $(configurator_generic_question_dialog "Move Data" "IN the previous version some user suddered a bug where ES-DE appeared empty (no scraped data or collections for example).\nYour data is not gone, it's just in a different path.\n\nDo you want to recover your old data replacing the actual one?") == "true" ]]; then
move_cmd="mv -f" # Use mv with overwrite
log i "User chose to move and overwrite the data."
else
move_cmd="move" # Use existing move function
log i "User chose to move the data without overwriting."
fi
# Move each directory if it exists
if [[ -d "$rdhome/themes" ]]; then if [[ -d "$rdhome/themes" ]]; then
move "$rdhome/themes" "$rdhome/ES-DE/themes" && log d "Move of \"$rdhome/themes\" completed" $move_cmd "$rdhome/themes" "$rdhome/ES-DE/themes" && log d "Move of \"$rdhome/themes\" completed"
else else
log i "ES-DE themes appears to already have been migrated." log i "ES-DE themes appears to already have been migrated."
fi fi
if [[ -d "$rdhome/downloaded_media" ]]; then if [[ -d "$rdhome/downloaded_media" ]]; then
move "$rdhome/downloaded_media" "$rdhome/ES-DE/downloaded_media" && log d "Move of \"$rdhome/downloaded_media\" completed" $move_cmd "$rdhome/downloaded_media" "$rdhome/ES-DE/downloaded_media" && log d "Move of \"$rdhome/downloaded_media\" completed"
else else
log i "ES-DE downloaded media appears to already have been migrated." log i "ES-DE downloaded media appears to already have been migrated."
fi fi
if [[ -d "$rdhome/gamelists" ]]; then if [[ -d "$rdhome/gamelists" ]]; then
move "$rdhome/gamelists" "$rdhome/ES-DE/gamelists" && log d "Move of \"$rdhome/gamelists/\" completed" $move_cmd "$rdhome/gamelists" "$rdhome/ES-DE/gamelists" && log d "Move of \"$rdhome/gamelists/\" completed"
else else
log i "ES-DE gamelists appears to already have been migrated." log i "ES-DE gamelists appears to already have been migrated."
fi fi
if [[ -d "$rdhome/collections" ]]; then if [[ -d "$rdhome/collections" ]]; then
move "$rdhome/collections" "$rdhome/ES-DE/collections" && log d "Move of \"$rdhome/collections/\" completed" $move_cmd "$rdhome/collections" "$rdhome/ES-DE/collections" && log d "Move of \"$rdhome/collections/\" completed"
else else
log i "ES-DE collections appears to already have been migrated." log i "ES-DE collections appears to already have been migrated."
fi fi
@ -380,6 +396,7 @@ post_update() {
fi fi
fi fi
# if [[ $(check_version_is_older_than "0.9.0b") == "true" ]]; then # if [[ $(check_version_is_older_than "0.9.0b") == "true" ]]; then
# # Placeholder for version 0.9.0b # # Placeholder for version 0.9.0b
# rm /var/config/emulationstation/.emulationstation # remving the old symlink to .emulationstation as it might be not needed anymore # rm /var/config/emulationstation/.emulationstation # remving the old symlink to .emulationstation as it might be not needed anymore