sync-library.sh: run the closing report under sh, not the remote login shell

The report was an ssh command string, which the remote user's login shell runs - and
on the devices root's is fish, which rejects `if ...; then`. The copy itself finished,
but the script then exited 127 at the very end, so a successful sync looked failed.
Feed the report to `sh -s` on stdin instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 21:22:21 +02:00
parent 683cda35cb
commit 61104d1e25

View File

@@ -224,14 +224,17 @@ if [[ $DRY_RUN -eq 1 ]]; then
exit 0 exit 0
fi fi
ssh "$SSH_TARGET" " # Through `sh -s` rather than as an ssh command string: that string is run by the
echo 'library: '\$(du -sh '$DEST' 2>/dev/null | cut -f1) # remote user's login shell, and on the devices root's is fish, which rejects
echo 'free: '\$(df -Ph '$DEST' | awk 'NR==2 {print \$4}') # `if ...; then`. The heredoc expands $DEST here; the escaped \$ ones run remotely.
if [ -d '${DEST}/.musicmouse-cache' ]; then ssh "$SSH_TARGET" sh -s <<EOF
echo 'covers: '\$(find '${DEST}/.musicmouse-cache/covers' -type f 2>/dev/null | wc -l)' files' echo "library: \$(du -sh '$DEST' 2>/dev/null | cut -f1)"
echo 'analysis: '\$(find '${DEST}/.musicmouse-cache/analysis' -type f 2>/dev/null | wc -l)' files' echo "free: \$(df -Ph '$DEST' | awk 'NR==2 {print \$4}')"
fi if [ -d '${DEST}/.musicmouse-cache' ]; then
" echo "covers: \$(find '${DEST}/.musicmouse-cache/covers' -type f 2>/dev/null | wc -l) files"
echo "analysis: \$(find '${DEST}/.musicmouse-cache/analysis' -type f 2>/dev/null | wc -l) files"
fi
EOF
cat <<EOF cat <<EOF