Blame build-papagayong-win.sh

e92ef7
#!/bin/bash
e92ef7
e92ef7
set -e
e92ef7
e92ef7
export IMAGE=build-fedora-cross-win
e92ef7
export TASK=papagayong-win
e92ef7
e92ef7
OLDDIR=`pwd`
e92ef7
BASE_DIR=$(cd `dirname "$0"`; pwd)
e92ef7
cd "$OLDDIR"
e92ef7
DATA_DIR="$BASE_DIR/docker-builder-data"
e92ef7
BUILD_DIR=$DATA_DIR/build
e92ef7
PUBLISH_DIR=$BASE_DIR/publish
e92ef7
e92ef7
CONFIG_FILE="$BASE_DIR/config.sh"
e92ef7
PACKET_BUILD_DIR="$BUILD_DIR/packet"
e92ef7
SCRIPT_BUILD_DIR="$BUILD_DIR/script"
e92ef7
if [ -f $CONFIG_FILE ]; then
e92ef7
	source $CONFIG_FILE
e92ef7
fi
e92ef7
e92ef7
run() {
e92ef7
	export SCRIPT="$BASE_DIR/docker/run.sh"
e92ef7
	export PLATFORM=win-${ARCH}
e92ef7
	export PLATFORM_SUFFIX=${ARCH}bit
e92ef7
e92ef7
	echo ""
e92ef7
	echo "Update papagayo-ng for ${PLATFORM}"
e92ef7
	echo ""
e92ef7
	
e92ef7
	$SCRIPT /build/script/common/manager.sh update papagayong-master
e92ef7
	$SCRIPT /build/script/common/manager.sh unpack papagayong-master
e92ef7
	
e92ef7
	# QUICK HACK:
e92ef7
	$SCRIPT /build/script/packet/papagayong-master.files/build-win.sh \
e92ef7
	        /build/packet/${PLATFORM}/papagayong-master
e92ef7
	
e92ef7
	local DIR="$PACKET_BUILD_DIR/$PLATFORM/papagayong-master/build"
e92ef7
	local FILE=`cd $DIR && ls -1 *.exe | head -n 1`
e92ef7
	local VERSION_FILE="$PACKET_BUILD_DIR/$PLATFORM/papagayong-master/unpack/version-papagayong-master"
e92ef7
	local VERSION=`echo "$FILE" | cut -d'-' -f 3`
e92ef7
	local COMMIT=`cat "$VERSION_FILE" | cut -d'-' -f 2-`
e92ef7
	COMMIT="${COMMIT:0:5}"
e92ef7
	local DATE=`date -u +%Y.%m.%d`
e92ef7
	if [ -z "$COMMIT" ]; then
e92ef7
		echo "Cannot find version, pheraps appimage not ready. Cancel."
e92ef7
		return 1
e92ef7
	fi
e92ef7
	if ! ls $PUBLISH_DIR/PapagayoNG-$VERSION-*-$COMMIT-win-installer.exe 1> /dev/null 2>&1; then
e92ef7
		echo "Publish new version $VERSION-$COMMIT-$PLATFORM"
e92ef7
		rm -f $PUBLISH_DIR/PapagayoNG-*-win-installer.exe
e92ef7
		cp "$DIR/$FILE" "$PUBLISH_DIR/PapagayoNG-$VERSION-$DATE-$COMMIT-win-installer.exe"
e92ef7
		if [ -f "$PUBLISH_DIR/publish-papagayong.sh" ]; then
e92ef7
			"$PUBLISH_DIR/publish-papagayong.sh" "$PUBLISH_DIR/PapagayoNG-$VERSION-$DATE-$COMMIT-win-installer.exe"
e92ef7
		fi
e92ef7
	else
e92ef7
		echo "Version $VERSION-$COMMIT-$PLATFORM_SUFFIX already published"
e92ef7
	fi
e92ef7
}
e92ef7
e92ef7
export ARCH=32
e92ef7
run