/core/externals/update-engine/Samples/EngineRunner/enginerunner-plist-generator.sh

http://macfuse.googlecode.com/ · Shell · 59 lines · 32 code · 5 blank · 22 comment · 2 complexity · 021d8381c6932889b432bdcd6f05d6d9 MD5 · raw file

  1. #!/bin/bash
  2. # Copyright 2008 Google Inc.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # A script to generate a property list config. This script should be
  16. # run from an Xcode shell-script build phase because it relies on some
  17. # environment variables that Xcode defines.
  18. #
  19. # Example:
  20. # cd "${TARGET_BUILD_DIR}" \
  21. # && bash enginerunner-plist-generator.sh > enginerunner.plist
  22. #
  23. if [ ${UPDATE_ENGINE_VERSION:=undefined} = "undefined" ]; then
  24. echo "UPDATE_ENGINE_VERSION env var not supplied. Exiting"
  25. exit 1
  26. fi
  27. dmg_name="EngineRunner-${UPDATE_ENGINE_VERSION}.dmg"
  28. now=$(date +%Y-%m-%d)
  29. size=$(stat -f%z "$dmg_name")
  30. hash=$(./kshash.sh "$dmg_name" | awk '{print $2}')
  31. cat <<__END_CONFIG
  32. <?xml version="1.0" encoding="UTF-8"?>
  33. <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  34. <!-- Created ${now} -->
  35. <plist version="1.0">
  36. <dict>
  37. <key>Rules</key>
  38. <array>
  39. <dict>
  40. <key>ProductID</key>
  41. <string>EngineRunner</string>
  42. <key>Predicate</key>
  43. <string>Ticket.version != '${UPDATE_ENGINE_VERSION}'</string>
  44. <key>Codebase</key>
  45. <string>http://update-engine.googlecode.com/files/${dmg_name}</string>
  46. <key>Size</key>
  47. <string>${size}</string>
  48. <key>Hash</key>
  49. <string>${hash}</string>
  50. </dict>
  51. </array>
  52. </dict>
  53. </plist>
  54. __END_CONFIG