From 12e678b1c964c3fa6b8bb62dddf19152032c0804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Tue, 16 Jan 2024 10:37:47 +0100 Subject: [PATCH] Add a flag to use rsync instead of scp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- cmd/limactl/guest_install.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/limactl/guest_install.go b/cmd/limactl/guest_install.go index f81b585a226c..ff81e5bb5925 100644 --- a/cmd/limactl/guest_install.go +++ b/cmd/limactl/guest_install.go @@ -24,6 +24,7 @@ func newGuestInstallCommand() *cobra.Command { ValidArgsFunction: cobra.NoFileCompletions, Hidden: true, } + guestInstallCommand.Flags().BoolP("rsync", "", false, "use rsync") return guestInstallCommand } @@ -36,6 +37,11 @@ func runCmd(name string, flags []string, args ...string) error { } func guestInstallAction(cmd *cobra.Command, args []string) error { + rsync, err := cmd.Flags().GetBool("rsync") + if err != nil { + return err + } + instName := DefaultInstanceName if len(args) > 0 { instName = args[0] @@ -55,6 +61,10 @@ func guestInstallAction(cmd *cobra.Command, args []string) error { scpExe := "scp" scpFlags := sshFlags + if rsync { + scpExe = "rsync" + scpFlags = []string{"-e", "ssh -F " + sshConfig, "--progress"} + } y, err := inst.LoadYAML() if err != nil {