gpg_check.sh 530 B

123456789101112131415
  1. #!/bin/sh
  2. ## This is my (demuredemeanor) polybar script for checking GPG
  3. ## This script handles checking if a GPG key/smartcard is in cache
  4. ## Note: also done by misc_status_check.sh
  5. ## Get status
  6. STATUS="$({ gpg-connect-agent 'keyinfo --list' /bye 2>/dev/null; gpg-connect-agent 'scd getinfo card_list' /bye 2>/dev/null; } | awk 'BEGIN{CH=0} /^S/ {if($7==1){CH=1}; if($2=="SERIALNO"){CH=1}} END{if($0!=""){print CH} else {print "none"}}')"
  7. ## Return icon results
  8. if [ $STATUS -eq 1 ];then
  9. echo ""
  10. else
  11. echo ""
  12. fi