17 lines
343 B
Bash
17 lines
343 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
CMD="/usr/bin/gpg --card-status"
|
||
|
|
||
|
|
||
|
text=""
|
||
|
tooltip=""
|
||
|
alt="missing"
|
||
|
ret=$($CMD 2> /dev/null)
|
||
|
if [ $? -eq 0 ]; then
|
||
|
tooltip="S/N: $(echo $ret | grep -oE 'Serial number[.:0-9 ]*' | grep -oE '[0-9]*')"
|
||
|
alt="available"
|
||
|
fi
|
||
|
|
||
|
json="{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"card\", \"alt\": \"$alt\"}"
|
||
|
echo $json
|