Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added spark updater #2191

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions examples/pxScene2d/src/macstuff/spark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ if [ -e ./version ] && [ -w . ]; then
VERSION=`cat ./version`
if [[ "$VERSION" != "edge"* ]]; then
UPDATE_URL=http://www.sparkui.org/dist/osx/spark/software_update.plist
./EngineRunner run -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL} &
./sparkUpdater.sh -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL}
else
if [[ $updateEdge == "true" ]] || [[ $updateEdge == 1 ]] ; then
UPDATE_URL=http://96.116.56.119/edge/osx/artifacts/software_update.plist
./EngineRunner run -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL} &
./sparkUpdater.sh -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL}
fi
fi
else
Expand Down
75 changes: 75 additions & 0 deletions examples/pxScene2d/src/macstuff/sparkUpdater.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
#./sparkUpdater.sh -productid org.pxscene.pxscene -version $VERSION -url ${UPDATE_URL}
#Get absolute path to this script
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd "$THIS_DIR"

PRODUCT_ID=$2
VERSION=$4
URL=$6
CURRENT_VERSION=0
CURRENT_PRODUCT_ID=0
CURRENT_CODEBASE=""
#echo "GIVEN" $PRODUCT_ID $VERSION $URL

SOFTWARE_UPDATE_PLIST="./software_update.plist"
DATA=$(cat $SOFTWARE_UPDATE_PLIST)
#echo $DATA
#P_ID=$(cat $SOFTWARE_UPDATE_PLIST | grep ^ProductID:$tag1 | cut -d "</key> <string>" -f 2)
#echo "P_ID=$P_ID"

idx=""
regex='<string>([A-za-z0-9.\:/]+)</string>'
while read -r line; do

if [[ $idx == "<key>ProductID</key>" ]]; then
CURRENT_PRODUCT_ID=$line
if [[ $CURRENT_PRODUCT_ID =~ $regex ]]
then
CURRENT_PRODUCT_ID=${BASH_REMATCH[1]}
fi
idx=""
fi
if [[ $line == "<key>ProductID</key>" ]]; then
idx=$line
fi
if [[ $idx == "<key>Version</key>" ]]; then
CURRENT_VERSION=$line
if [[ $CURRENT_VERSION =~ $regex ]]
then
CURRENT_VERSION=${BASH_REMATCH[1]}
fi
idx=""
fi
if [[ $line == "<key>Version</key>" ]]; then
idx=$line
fi
if [[ $idx == "<key>Codebase</key>" ]]; then
CURRENT_CODEBASE=$line
if [[ $CURRENT_CODEBASE =~ $regex ]]
then
CURRENT_CODEBASE=${BASH_REMATCH[1]}
fi
idx=""
fi
if [[ $line == "<key>Codebase</key>" ]]; then
idx=$line
fi



done <<< "$DATA"


#echo "CURRENT" $CURRENT_PRODUCT_ID $CURRENT_VERSION $CURRENT_CODEBASE
if [[ $PRODUCT_ID == $CURRENT_PRODUCT_ID ]]; then

if [[ $CURRENT_VERSION != $VERSION ]]; then
echo "UPDATE"
sudo hdiutil attach $URL
fi

fi

#echo "${BASH_SOURCE[0]}"