WRAPPER: attempt to fix the SD Card issue

This commit is contained in:
Steam Deck User 2022-06-05 19:30:29 +02:00
parent 142dce96d6
commit bf60ef4615

View file

@ -58,10 +58,10 @@ dir_prep() {
echo $symlink is now $real echo $symlink is now $real
} }
is_mounted() { # is_mounted() {
# This script checks if the provided path in $1 is mounted # # This script checks if the provided path in $1 is mounted
mount | awk -v DIR="$1" '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}' # mount | awk -v DIR="$1" '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}'
} # }
tools_init() { tools_init() {
rm -rfv /var/config/retrodeck/tools/ rm -rfv /var/config/retrodeck/tools/
@ -168,13 +168,35 @@ finit() {
then then
roms_folder="$rdhome/roms" roms_folder="$rdhome/roms"
else #no - SD Card else #no - SD Card
if [ is_mounted "$sdcard" ]; if [ -d "$sdcard" ];
then then
roms_folder="$sdcard/retrodeck/roms" roms_folder="$sdcard/retrodeck/roms"
else else
zenity --error --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="SD Card is not readable.\nPlease check if it's inserted or mounted correctly and run RetroDECK again." sdselected=false
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="SD Card was not find in the default location.\nPlease choose the SD Card root.\nA retrodeck/roms folder will be created starting from the directory that you selected."
if [ $? == 1 ] #cancel
then
exit 0 exit 0
fi fi
while [ $sdselected == false ]
do
sdcard="$(zenity --file-selection --title="Choose SD Card root" --directory)"
echo "DEBUG: sdcard=$sdcard, answer=$?"
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="No" --ok-label "Yes" --text="Your rom folder will be:\n\n$sdcard/retrodeck/roms\n\nis that ok?"
if [ $? == 0 ] #yes
then
sdselected == true
roms_folder="$sdcard/retrodeck/roms"
break
else
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="No" --ok-label "Yes" --text="Do you want to quit?"
if [ $? == 0 ] # yes, quit
then
exit 0
fi
fi
done
fi
fi fi
mkdir -pv $roms_folder mkdir -pv $roms_folder