Created
April 26, 2022 11:52
-
-
Save bboozzoo/53d8d07be5ec01f7e1b693b33831eba5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
if [ "$#" -ne 2 ] || [ "$1" = "--help" ]; then | |
echo "usage: $0 <key-name> <system-user-assertion-json>" | |
exit 1 | |
fi | |
# sign the assertion | |
sysUser=$(snap sign -k $1 < $2) | |
accountID=$(echo "$sysUser" | grep -Po "authority-id:\s+\K.*") | |
signingKeySha=$(echo "$sysUser" | grep -Po "sign-key-sha3-384:\s+\K.*" ) | |
{ | |
# get the account key assertion from the store | |
snap known --remote account "account-id=$accountID" | |
echo "" | |
# get the signing account-key assertion from the store | |
snap known --remote account-key "public-key-sha3-384=$signingKeySha" | |
echo "" | |
echo "$sysUser" | |
} > auto-import.assert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment