Bump? Still looking for any way to modify the USB Sync script to only sync saves. I ended up trying to modify the 01_retropie_copyroms file, but it hangs up on my script.
What I did was add --exclude '*.xxx" for all the rom files on the ROM/BIOS sync line, and swap the source and destination in the rsync command so it now reads the USB path first, and retropie second. Finally, I tried removing the usermod line, since I'm syncing the filed FROM the pi to USB.
The script still automounts the USB, and created the file structure (rsync maxdepth=1) but it fails to fill the directory with the save games.
Still new to scripting (This device is a learning tool) What have I missed?
#!/bin/bash
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 / defaultsuser="pi"
home="$(eval echo ~$user)"
rootdir="/opt/retropie"
retropie_path="$home/RetroPie"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 locationpath_mapping["configs"]="$rootdir/configs"
internalshook_name=${0##*/}
functionsfunction log() {
logger -p user.$1 -t usbmount-"$hook_name"-[$$] -- "$2"
}function log_cmd() {
some sanity checking
local ret
local error
error="$("$@" 2>&1 >/dev/null)"
ret=$?
[[ "$ret" -ne 0 ]] && log err "$* - returned $ret - $error"
}if [[ -z "$UM_MOUNTPOINT" ]]; then
log err "UM_MOUNTPOINT not set!"
exit 0
fiif [[ ! -d "$UM_MOUNTPOINT" ]]; then
make sure we have something to sync from
log err "UM_MOUNTPOINT is not a directory"
exit 0
fiif [[ ! -d "$usb_path" ]]; then
make folders for syncing
exit 0
fimkdir -p "$usb_path/"{roms,BIOS} "$usb_path_from_rp" "$usb_path_to_rp"
mirror romdir structure to external drivelog info "Attempting to create directory structure for ROMS in '$usb_path/roms' >..."
fetch list of romdirs from current installation and mirror onto external drivefind "$retropie_path/roms" -mindepth 1 -maxdepth 1 -type d -printf >"$usb_path/roms/%f\n" | xargs mkdir -p 2>/dev/null || true
copy SAVES ONLY from Local SD card stick to USBfor dir in roms BIOS; do
log info "Syncing $dir ..."
log_cmd rsync -au --exclude '._' --exclude '.32x' --exclude '.bin' --exclude >'.cue' --exclude '.gb' --exclude '.gba' --exclude '.gbc' --exclude '.gen' -->exclude '.gg' --exclude '.md' --exclude '.ndd' --exclude '.nes' --exclude '.pce' >--exclude '.sfc' --exclude '.smc' --exclude '.sms' --exclude '.vb' --exclude >'.z64' --exclude '*.zip' --max-delete=-1 "$retropie_path/" "$usb_path/$dir"
chown -R $user:$user "$retropie_path/$dir"
donelog info "Syncing configs ..."
copy configs to usbfor to in "${!path_mapping[@]}"; do
copy configs from usb
from=${path_mapping[$to]}
log_cmd rsync -au --exclude '._*' --max-delete=-1 "$from/" >"$usb_path_from_rp/$to/"
donefor from in $(find "$usb_path_to_rp/" -mindepth 1 -maxdepth 1); do
basenamefrom_bn=${from##/}
unmount USB stick
to=${path_mapping[$from_bn]}
if [[ -n "$to" ]]; then
log_cmd rsync -au --exclude '._' --max-delete=-1 "$from/" "$to/"
chown -R $user:$user "$to"
fi
doneumount "$UM_MOUNTPOINT"
I don't use forums either apparently, because I can't find a way to use that nifty box that allows me to add code. the --exclude DOES have a *.xxx, but it doesn't show up.