| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Custom script to be called by the Mender client when a new artifact |
| 4 | # is available for download. This can be used to demonstrate state |
| 5 | # scripting by the user manually creating files in /tmp. |
| 6 | # |
| 7 | |
| 8 | log() { |
| 9 | echo "mender:$*" >&2 |
| 10 | } |
| 11 | |
| 12 | log "$(cat /etc/mender/artifact_info): $(basename "$0") was called!" |
| 13 | |
| 14 | RC=0 |
| 15 | UPD=`dbus-send --system \ |
| 16 | --dest=org.mender.updater \ |
| 17 | --print-reply \ |
| 18 | --type=method_call \ |
| 19 | / \ |
| 20 | local.ServiceQtUpdater.CMenderQtUpdater.enableUpdate | \ |
| 21 | grep "byte" | \ |
| 22 | awk '{print $2}'` |
| 23 | |
| 24 | RC=$UPD |
| 25 | |
| 26 | log "Returning $RC from $0 state script" |
| 27 | exit $RC |