Skip to content

rclone: safer restores, RSYNCRMDIR, drop legacy mount code#3055

Open
maxengel wants to merge 1 commit into
ROCKNIX:nextfrom
maxengel:pr/rclone-cleanup
Open

rclone: safer restores, RSYNCRMDIR, drop legacy mount code#3055
maxengel wants to merge 1 commit into
ROCKNIX:nextfrom
maxengel:pr/rclone-cleanup

Conversation

@maxengel

Copy link
Copy Markdown
Contributor

Correctness and safety cleanup of the cloud backup/restore tools, squashed to a single commit for review. Docs PR: ROCKNIX/rocknix.org#176.

  • Restore can no longer delete local data. The filter rules are an allowlist, so on a RESTOREMETHOD="sync" restore a user-supplied --delete-excluded would delete everything local that isn't a save/state/screenshot (ROMs, BIOS, artwork). It is now stripped during restore option normalization (same pattern as the existing --verbose strip); backup keeps it, where it only tidies the remote. Also removes the dead RESTORE_RCLONEOPTS assignment.
  • RSYNCRMDIR actually works now. It shipped enabled and documented on rocknix.org, but no script ever read it. After a successful game-saves backup, cloud_backup prunes empty remote directories via rclone rmdirs --leave-root (non-fatal on failure).
  • Legacy pre-cloud_sync code removed: the rclonectl FUSE-mount wrapper and its rsync.conf/rsync-rules.conf (reachable only via manual SSH, no UI entry) plus the post-update block that re-seeded them on every OS update. Existing copies on user storage are left untouched.
  • Smaller fixes: rclone exit code 9 reported as "no files transferred" instead of an error; --stats-one-line in the game-saves flows; removal of controller-input regex branches that could never match (quoted patterns were compared literally); cloud_sync_helper now creates the initial config with sed so the multi-line RCLONEOPTS default survives intact.

Verified with tools/pkgcheck (rclone + rocknix packages), bash -n on all touched scripts, and a repo-wide grep for dangling references.

💘 Generated with Crush

@maxengel
maxengel force-pushed the pr/rclone-cleanup branch from daa008f to 8247f63 Compare July 24, 2026 15:57
@maxengel maxengel changed the title rclone - cloud-sync: safer restores, RSYNCRMDIR, drop legacy mount code rclone: safer restores, RSYNCRMDIR, drop legacy mount code Jul 24, 2026
@maxengel
maxengel force-pushed the pr/rclone-cleanup branch from 8247f63 to 8be2f6f Compare July 24, 2026 17:42
@maxengel

Copy link
Copy Markdown
Contributor Author

Correction to the description: rclonectl did have one UI reference — EmulationStation's Network Settings "MOUNT CLOUD DRIVE" toggle. A companion emulationstation-next change replaces that toggle with native CLOUD BACKUP / CLOUD RESTORE entries that launch the supported cloud_sync scripts; PR to follow once build-verified. Merging this PR first is safe: the toggle fails silently today only if a user flips it.

Correctness and safety cleanup of the cloud backup/restore tools:

- Restore can no longer delete local data: --delete-excluded is
  stripped during restore option normalization. The filter rules are
  an allowlist, so on a RESTOREMETHOD="sync" restore that flag would
  have deleted everything local that isn't a save/state/screenshot
  (ROMs, BIOS, artwork). Backup keeps it, where it only tidies the
  remote. Also removes the dead RESTORE_RCLONEOPTS assignment.
- Implement RSYNCRMDIR: it shipped enabled and documented but no
  script ever read it. After a successful game-saves backup,
  cloud_backup now prunes empty remote directories via
  rclone rmdirs --leave-root.
- Report rclone exit code 9 as "no files transferred" instead of a
  retry failure, add --stats-one-line to the game-saves flows, and
  remove controller-input regex branches that could never match
  (quoted patterns were compared literally).
- Apply the capability-checked --progress-terminal-width flag in all
  four rclone flows instead of only the system-backup restore.
- cloud_sync_helper: create the initial config with sed so multi-line
  backslash-continued values like RCLONEOPTS survive intact; the old
  line-based loop truncated them.
- Remove the pre-cloud_sync legacy path: the rclonectl FUSE-mount
  wrapper and its rsync.conf/rsync-rules.conf (reachable only via
  manual SSH, no UI entry) plus the post-update block that re-seeded
  them on every OS update, and 001-setup's boot-time reset of the
  now-removed cloud-mount toggle state. Existing copies on user
  storage are left untouched.

💘 Generated with Crush

Assisted-by: Crush:anthropic/claude-fable-5
@maxengel
maxengel force-pushed the pr/rclone-cleanup branch from dc0ff93 to e35e5e8 Compare July 25, 2026 19:05
@maxengel

Copy link
Copy Markdown
Contributor Author

Rebased onto current next. The remaining check failure is only the release-freeze gate: could a maintainer add the bugfix label? This PR is bug-fix material — it closes a restore-side data-loss hazard (--delete-excluded on a sync restore would delete everything outside the saves allowlist), implements the documented-but-inert RSYNCRMDIR, fixes the misreported rclone exit code 9, repairs the multi-line RCLONEOPTS truncation in config creation, and removes dead legacy code that reseeded stale configs on every update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant