#!/bin/sh
# dailybuild.sh
# BusinessOn
#
# Created by 吴小海 on 12-12-11.
#
FILE_NAME="ibmevents.ipa"
BUILD_PATH=""
echo $FILE_NAME
echo $BUILD_PATH
xcodebuild -configuration DailyBuild -target "BusinessOn"
#echo $BUILD_PATH
cd build
mkdir -p ipa/Payload
cp -r ./DailyBuild-iphoneos/$PRODUCT_NAME ./ipa/Payload/
cd ipa
zip -r $FILE_NAME *
cat << EOF > install.html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>安装此软件</title>
</head>
<body>
<ul>
<li>安装此软件:<a href="itms-services://?action=download-manifest&url=http%3A%2F%2F192.168.88.101%2Fynote.plist">$FILE_NAME</a></li>
</ul>
</div>
</body>
</html>
EOF
cat << EOF > ynote.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>http://192.168.88.101/$FILE_NAME</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>http://192.168.88.101/icon.png</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>http://192.168.88.101/icon.png</string>
</dict>
</array><key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.blueweb.erp.ibmevents</string>
<key>bundle-version</key>
<string>1.0.0</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>ProductName</string>
<key>title</key>
<string>IBM资讯人脉掌上通</string>
</dict>
</dict>
</array>
</dict>
</plist>
EOF