01_retropie_copyroms seems broken (won't sync BIOS and configs)
-
It seems that the 01_retropie_copyroms script is broken. When trying to sync from USB, the BIOS folder (and configs) will not sync. Only the "roms" directory will sync (at least for me). I believe the error is in the log_cmd function, but I'm not super great at bash scripting. The following seems to fix the problem, but it doesn't have the exact same functionality for error logging.
#!/bin/bash -ue # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # ## config / defaults user="pi" home="$(eval echo ~$user)" rootdir="/opt/retropie" retropie_path="$home/RetroPie" #UM_MOUNTPOINT="/media/usb" usb_path="$UM_MOUNTPOINT/retropie" usb_path_from_rp="$usb_path/configs/from_retropie" usb_path_to_rp="$usb_path/configs/to_retropie" declare -A path_mapping # mapping from usb_path_to_rp/* to retropie location path_mapping["configs"]="$rootdir/configs" ## internals hook_name=${0##*/} ## functions function log() { logger -p user.$1 -t usbmount-"$hook_name"-[$$] -- "$2" } function log_cmd() { local ret local error # error="$("$@" 2>&1 >/dev/null)" eval "$@" ret=$? if [ "$ret" -ne 0 ]; then log err "${@} - returned $ret - [$error]"; fi } ## some sanity checking if [[ -z "$UM_MOUNTPOINT" ]]; then log err "UM_MOUNTPOINT not set!" exit 0 fi if [[ ! -d "$UM_MOUNTPOINT" ]]; then log err "UM_MOUNTPOINT is not a directory" exit 0 fi # make sure we have something to sync from if [[ ! -d "$usb_path" ]]; then exit 0 fi # make folders for syncing mkdir -p "$usb_path/"{roms,BIOS} "$usb_path_from_rp" "$usb_path_to_rp" # mirror romdir structure to external drive log info "Attempting to create directory structure for ROMS in '$usb_path/roms' ..." # fetch list of romdirs from current installation and mirror onto external drive find "$retropie_path/roms" -mindepth 1 -maxdepth 1 -type d -printf "$usb_path/roms/%f\n" | xargs mkdir -p 2>/dev/null || true # copy ROMs/BIOS from USB stick to local SD card for dir in roms BIOS ; do log info "Syncing $dir ..." log_cmd "rsync -rtu --exclude '._*' --max-delete=-1 \"$usb_path/$dir\" \"$retropie_path/\"" chown -R $user:$user "$retropie_path/$dir" done log info "Syncing configs ..." # copy configs to usb for to in "${!path_mapping[@]}"; do from=${path_mapping[$to]} log_cmd "rsync -rtu --exclude '._*' --max-delete=-1 \"$from/\" \"$usb_path_from_rp/$to/\"" done # copy configs from usb for from in $(find "$usb_path_to_rp/" -mindepth 1 -maxdepth 1); do # basename from_bn=${from##*/} to=${path_mapping[$from_bn]} if [[ -n "$to" ]]; then #log_cmd rsync -rtu --exclude '._*' --max-delete=-1 "$from/" "$to/" chown -R $user:$user "$to" fi done # unmount USB stick umount "$UM_MOUNTPOINT"
Notice that I also changed the call to log_cmd to quote the entire argument.
-
@flavor when's the last time you updated. There were some fixes done semi recently
-
I think I updated maybe Tuesday. I don't think I updated the kernel, though.
I'm not sure if you're suggesting that an update could have caused it or if I should update to fix it.
-
@flavor after updating the setup script did you disable/re-enable the Usbromservice through the setup script to include the latest changes?
-
@herb_fargus said in 01_retropie_copyroms seems broken (won't sync BIOS and configs):
@flavor after updating the setup script did you disable/re-enable the Usbromservice through the setup script to include the latest changes?
@herb_fargus No. Well, I didn't run anything manually. Is that something I need to run manually?
I just searched and found https://retropie.org.uk/forum/topic/10386/usb-romservice-bios-transfer-bug/6 where I see @buzz may have already fixed it. I'll try to see what he changed.I will try to see if I can do the usbromservice enable/disable thing tomorrow.
-
I disabled/enabled the usbromservice. It seems to have updated the script (removed the -ue arguments from bash) and seems to be rsync'ing the BIOS/configs now.
Of course this is completely unintuitive for someone that does an update. I hope there's a way to have the update automatically disable/enable usbromservice to update the script.
Thanks for the help!
-
@flavor I have some code that does this but it's not yet committed as needs testing. It should enable usbromservice to update when updating retropie without having to disable/re-enable. I will commit it once I have tested it further.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.