From c0de353ccdf2ba48ed982e864dca87f3e6178ab2 Mon Sep 17 00:00:00 2001 From: Dimi Kot Date: Fri, 4 Oct 2024 23:03:39 -0700 Subject: [PATCH] Add --fake-super to allow ci-storage to be run as root in the source machine and still backup/restore files owners correctly, even though it doesn't have root access on destination Pull Request: https://github.com/dimikot/ci-storage/pull/22 (main) --- ci-storage | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ci-storage b/ci-storage index 7e39286..5ba7fff 100755 --- a/ci-storage +++ b/ci-storage @@ -492,11 +492,15 @@ def cmd_to_debug_str( cmd: list[str], ) -> str: inv = dict((v, k) for k, v in SCRIPTS.items()) - return shlex.join( - [ - f"<{inv[arg]}>" if arg in inv else arg.rstrip().replace("\n", "\\n") - for arg in cmd - ] + return re.sub( + r" '(--[^=]+=)", + r" \1'", + shlex.join( + [ + f"<{inv[arg]}>" if arg in inv else arg.rstrip().replace("\n", "\\n") + for arg in cmd + ] + ), ) @@ -583,6 +587,7 @@ def build_rsync_args( else [] ), *(["--prune-empty-dirs"] if layer and action == "store" else []), + *(["--rsync-path=rsync --fake-super"] if os.geteuid() == 0 else []), ]