1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
summary: Check that snap model works
details: |
Check that the information returned by `snap model` matches the device's
model and serial assertions.
execute: |
knownCmdAssertion=$(snap known model)
modelCmdAssertion=$(snap model --assertion)
echo "Check that model assertion from \"snap known\" matches \"snap model\""
if [ "$modelCmdAssertion" != "$knownCmdAssertion" ]; then
echo "model assertions not the same, difference is:"
diff -u <(echo "$modelCmdAssertion") <(echo "$knownCmdAssertion")
exit 1
fi
knownCmdAssertion=$(snap known serial)
modelCmdAssertion=$(snap model --serial --assertion)
echo "Check that serial assertion from \"snap known\" matches \"snap model\""
if [ "$modelCmdAssertion" != "$knownCmdAssertion" ]; then
echo "serial assertions not the same, difference is:"
diff -u <(echo "$modelCmdAssertion") <(echo "$knownCmdAssertion")
exit 1
fi
modelCmdSerial="$(snap model --serial | grep -Po "serial:\s+\K(.*)")"
knownCmdSerial="$(snap known serial | grep -Po "serial:\s+\K(.*)")"
echo "Check that serial from \"snap known\" matches \"snap model\""
if [ "$modelCmdSerial" != "$knownCmdSerial" ]; then
echo "serial numbers not the same, difference is:"
diff -u <(echo "$modelCmdSerial") <(echo "$knownCmdSerial")
exit 1
fi
# the model may have a display-name so `snap model` output will be different,
# so use `snap model --verbose` which will not show the display-name alongside
# the model
modelCmdModel="$(snap model --verbose | grep -Po "model:\s+\K(.*)")"
knownCmdModel="$(snap known model | grep -Po "model:\s+\K(.*)")"
echo "Check that model from \"snap known\" matches \"snap model\""
if [ "$modelCmdModel" != "$knownCmdModel" ]; then
echo "models not the same, difference is:"
diff -u <(echo "$knownCmdModel") <(echo "$modelCmdModel")
exit 1
fi
|