diff --git a/cli/.gitignore b/cli/.gitignore index 084f131b..8ad23448 100644 --- a/cli/.gitignore +++ b/cli/.gitignore @@ -2,3 +2,4 @@ artifact_info input.mender.txt test.txt testkey +artifact.mender \ No newline at end of file diff --git a/cli/artifact.mender b/cli/artifact.mender deleted file mode 100644 index 9bbcf884..00000000 Binary files a/cli/artifact.mender and /dev/null differ diff --git a/cli/write.go b/cli/write.go index 655117bf..044cb1d5 100644 --- a/cli/write.go +++ b/cli/write.go @@ -880,10 +880,13 @@ func getDeviceSnapshot(c *cli.Context) (string, error) { args, "/bin/sh", "-c", - `'mender_snapshot="mender snapshot"`+ - `; which mender-snapshot 1> /dev/null && mender_snapshot="mender-snapshot"`+ - `; [ $(id -u) -eq 0 ] || sudo_cmd="sudo -S"`+ - `; $sudo_cmd /bin/sh -c "echo `+sshInitMagic+`; $mender_snapshot dump" | cat'`, + `'[ $(id -u) -eq 0 ] || sudo_cmd="sudo -S"`+ + `; if which mender-snapshot 1> /dev/null`+ + `; then $sudo_cmd /bin/sh -c "echo `+sshInitMagic+`; mender-snapshot dump" | cat`+ + `; elif which mender 1> /dev/null`+ + `; then $sudo_cmd /bin/sh -c "echo `+sshInitMagic+`; mender snapshot dump" | cat`+ + `; else echo "Mender not found: Please check that Mender is installed" >&2 &&`+ + `exit 1; fi'`, ) cmd := exec.Command("ssh", args...)