Skip to content

Commit c83502e

Browse files
chore: split dbus-send and string maniplation
We're running the script with `-e`; by splitting these two things into two steps we allow the script to exit if it fails to perform `dbus-send`, i.e. if mender-authd is not running. Signed-off-by: Daniel Skinstad Drabitzius <daniel.drabitzius@northern.tech>
1 parent 39e893f commit c83502e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/mender-inventory-mender-configure

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ if ! [ -f "$CONFIG" ]; then
3030
fi
3131

3232
# Fetch Authentication token and server from Mender Auth Manager.
33-
DBUS_REPLY="$(dbus-send \
34-
--system \
35-
--print-reply \
36-
--dest=io.mender.AuthenticationManager \
37-
/io/mender/AuthenticationManager \
38-
io.mender.Authentication1.GetJwtToken \
39-
| sed -ne '/^ *string ".*" *$/ {s/^ *string "\(.*\)" *$/\1/; p}')"
33+
DBUS_RAW=$(dbus-send \
34+
--system \
35+
--print-reply \
36+
--dest=io.mender.AuthenticationManager \
37+
/io/mender/AuthenticationManager \
38+
io.mender.Authentication1.GetJwtToken)
39+
40+
DBUS_REPLY=$(echo "$DBUS_RAW" | sed -ne '/^ *string ".*" *$/ {s/^ *string "\(.*\)" *$/\1/; p}')
4041

4142
AUTH_TOKEN="$(echo "$DBUS_REPLY" | sed -ne '1p')"
4243
SERVER="$(echo "$DBUS_REPLY" | sed -ne '2p')"

0 commit comments

Comments
 (0)