core: fix code comment in _host_id_hash_v2()

The previous snippet was wrong, there was an additional newline after
`stat`. Fix that and reformat the comment.
This commit is contained in:
Thomas Haller 2022-10-25 10:17:20 +02:00
parent 11a34405ef
commit 9f534341e0
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2717,11 +2717,17 @@ _host_id_hash_v2(const guint8 *seed_arr,
const UuidData *machine_id_data;
char slen[100];
/*
(stat -c '%s' /var/lib/NetworkManager/secret_key;
echo -n ' ';
cat /var/lib/NetworkManager/secret_key;
cat /etc/machine-id | tr -d '\n' | sed -n 's/[a-f0-9-]/\0/pg') | sha256sum
/* The following snippet generates the same (binary) host-id:
(
stat -c '%s' /var/lib/NetworkManager/secret_key | tr -d '\n';
echo -n ' ';
cat /var/lib/NetworkManager/secret_key;
cat /etc/machine-id | tr -d '\n' | sed -n 's/[a-f0-9-]/\0/pg'
) \
| sha256sum \
| awk '{print $1}' \
| xxd -r -p
*/
nm_sprintf_buf(slen, "%" G_GSIZE_FORMAT " ", seed_len);