PageRenderTime 22ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/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
16# A script to generate a property list config. This script should be
17# run from an Xcode shell-script build phase because it relies on some
18# environment variables that Xcode defines.
19#
20# Example:
21#   cd "${TARGET_BUILD_DIR}" \
22#   && bash enginerunner-plist-generator.sh > enginerunner.plist
23#
24
25if [ ${UPDATE_ENGINE_VERSION:=undefined} = "undefined" ]; then
26  echo "UPDATE_ENGINE_VERSION env var not supplied.  Exiting"
27  exit 1
28fi
29
30
31dmg_name="EngineRunner-${UPDATE_ENGINE_VERSION}.dmg"
32now=$(date +%Y-%m-%d)
33size=$(stat -f%z "$dmg_name")
34hash=$(./kshash.sh "$dmg_name" | awk '{print $2}')
35
36cat <<__END_CONFIG
37<?xml version="1.0" encoding="UTF-8"?>
38<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
39<!-- Created ${now} -->
40<plist version="1.0">
41<dict>
42  <key>Rules</key>
43  <array>
44    <dict>
45      <key>ProductID</key>
46      <string>EngineRunner</string>
47      <key>Predicate</key>
48      <string>Ticket.version != '${UPDATE_ENGINE_VERSION}'</string>
49      <key>Codebase</key>
50      <string>http://update-engine.googlecode.com/files/${dmg_name}</string>
51      <key>Size</key>
52      <string>${size}</string>
53      <key>Hash</key>
54      <string>${hash}</string>
55    </dict>
56  </array>
57</dict>
58</plist>
59__END_CONFIG