Skip to content

Commit

Permalink
Merge pull request #652 from bahaa-ghazal/master
Browse files Browse the repository at this point in the history
chore: Improving error message
  • Loading branch information
alfrunes authored Dec 12, 2024
2 parents 550e69f + 7b1d576 commit dc20f03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ artifact_info
input.mender.txt
test.txt
testkey
artifact.mender
Binary file removed cli/artifact.mender
Binary file not shown.
11 changes: 7 additions & 4 deletions cli/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit dc20f03

Please sign in to comment.