Advertisement
Guest User

Code snippets of interest

a guest
Apr 18th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.01 KB | None | 0 0
  1. check_signature(){
  2. # $1 name of file
  3. # $2 keyid
  4. if [ "$2" ] ; then
  5.     keyid=$(gpg --keyserver-options auto-key-retrieve $1.sign 2>&1)
  6.     gpgok=$?
  7.     keyid=$(grep -F "Signature made" <<< "$keyid")
  8.     keyid=${keyid##* }
  9.     if [ "$keyid" != "$2" ] ; then
  10.         echo -e "\n${COLOR_ERROR}Key-ID is not the same as specified in package list${COLOR_NORMAL}"
  11.         echo "${COLOR_ERROR}expected keyid: $2 ${COLOR_NORMAL}"
  12.         echo "${COLOR_ERROR}file '$1' is signed by keyid $keyid instead.${COLOR_NORMAL}"
  13.         [ $gpgok -eq 0 ] && echo "${COLOR_WARN}at least *that* signature is ok ;)"
  14.         return 1
  15.     fi
  16. fi
  17. GPG_OUTPUT=$(gpg --keyserver-options auto-key-retrieve $1.sign 2>&1)
  18. }
  19. #You may need to modify this
  20.  
  21. sign_pkg(){
  22. # $1: filename of file to be signed
  23. gpg -o $1.sign -b $1
  24. keyid=$(gpg $filename.sign 2>&1 | grep "Signature made")
  25. keyid=${keyid##* }
  26. }
  27. #copypaste this near the end of makepkg's building and call the function if you want it to do it automatically, otherwise you might also want to add an option to sign the resulting file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement