Image building tools for OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright 2014 Hewlett-Packard Development Company, L.P.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. # not use this file except in compliance with the License. You may obtain
  7. # a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. # License for the specific language governing permissions and limitations
  15. # under the License.
  16. if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
  17. set -x
  18. fi
  19. set -eu
  20. set -o pipefail
  21. KEY_DIRECTORY=/tmp/apt_keys
  22. if [ ! -d "${KEY_DIRECTORY}" ]; then
  23. exit 0
  24. fi
  25. for KEY in ${KEY_DIRECTORY}/*; do
  26. if ! file -b "${KEY}" | grep -qE '(PGP public key block|GPG key public ring)'; then
  27. echo "Skipping ${KEY}, not a valid GPG public key"
  28. continue
  29. fi
  30. apt-key add ${KEY}
  31. done
  32. apt-get -y update