signer.sh 1009 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. #
  9. set +x
  10. export GPG_TTY=$(tty) # Required to pass valid tty during ssh sessions
  11. file=$1
  12. # dpkg-sig depends on a valid and trusted GPG private key. This also assumes a private key password has already been cached via gpg-agent
  13. # If you do need to pass a password, a gpg argument can be added to the command:
  14. # dpkg-sig -k $fingerprint -g "--pinentry-mode loopback --passphrase $pass" --sign builder
  15. fingerprint=$(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | tail -n1) #Get the last certificate in the list, which is the signing cert
  16. if [ -z $fingerprint ]; then
  17. echo "No valid certs found. Exiting with 1"
  18. exit 1
  19. fi
  20. echo "Signing with $fingerprint"
  21. dpkg-sig -k $fingerprint --sign builder $file
  22. dpkg-sig --verify $file && echo "Signing $file complete!"