RetroDECK/tools/move-roms.sh

33 lines
1.7 KiB
Bash
Raw Normal View History

2022-04-06 15:20:47 +00:00
#!/bin/bash
2022-06-09 08:25:20 +00:00
source global.sh
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="Quit" --ok-label "Continue" --text="WARNING: this script is experimental\nplease be sure to backup your data before continuing.\n\nDo you want to continue?"
2022-06-09 08:25:20 +00:00
if [ $? == 1 ] #cancel
then
2022-04-06 15:20:47 +00:00
exit 0
fi
2022-09-07 18:37:27 +00:00
#conf_init
2022-04-06 15:20:47 +00:00
2022-06-09 08:25:20 +00:00
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="Cancel" --ok-label "Browse" --text="The roms folder is now: $roms_folder\nplease select the new location.\nA retrodeck/roms folder will be created starting from the directory that you selected."
if [ $? == 1 ] #cancel
then
exit 0
2022-04-06 15:20:47 +00:00
fi
2022-06-09 08:25:20 +00:00
new_roms_path="$(zenity --file-selection --title="Choose a new roms folder location" --directory)"/retrodeck/roms
2022-04-06 15:20:47 +00:00
2022-06-09 08:25:20 +00:00
zenity --title "RetroDECK" --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --text="Should I move the roms from\n\n$roms_folder\n\nto\n\n$new_roms_path?"
2022-04-25 02:45:26 +00:00
if [ $? == 0 ] #yes
then
mkdir -p $new_roms_path
2022-06-09 08:25:20 +00:00
mv -f $roms_folder $new_roms_path
2022-04-25 02:45:26 +00:00
rm -f /var/config/emulationstation/ROMs
2022-06-09 08:25:20 +00:00
ln -s $new_roms_path /var/config/emulationstation/ROMs
rm -f $roms_folder
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="Done\nYour roms are now located in:\n\n$roms_folder\n\nPress OK to continue."
$roms_folder=$new_roms_path # Updating variable
conf_write # Writing variables in the config file (sourced from global.sh)
2022-04-25 02:45:26 +00:00
fi