Blame publish/update-opentoonz-linux.sh

6abdee
#!/bin/bash
6abdee
6abdee
set -e
6abdee
cc5124
export IMAGE=build-debian-7
cc5124
export TASK=opentoonz-linux
cc5124
6abdee
OLDDIR=`pwd`
6abdee
BASE_DIR=$(cd `dirname "$0"`; pwd)
6abdee
BASE_DIR=`dirname "$BASE_DIR"`
6abdee
cd "$OLDDIR"
6abdee
DATA_DIR="$BASE_DIR/docker-builder-data"
6abdee
BUILD_DIR=$DATA_DIR/build
17be73
PUBLISH_DIR=$BASE_DIR/publish
6abdee
6abdee
CONFIG_FILE="$BASE_DIR/config.sh"
6abdee
PACKET_BUILD_DIR="$BUILD_DIR/packet"
6abdee
SCRIPT_BUILD_DIR="$BUILD_DIR/script"
6abdee
if [ -f $CONFIG_FILE ]; then
6abdee
	source $CONFIG_FILE
6abdee
fi
6abdee
6abdee
run() {
26f5ff
	export SCRIPT=$1
26f5ff
	export PLATFORM=$2
26f5ff
	export PLATFORM_SUFFIX=${ARCH}bit
6abdee
6abdee
	echo ""
6abdee
	echo "Update opentoonz for $PLATFORM_SUFFIX"
6abdee
	echo ""
6abdee
	
cc5124
	sudo $SCRIPT /build/script/common/manager.sh update opentoonz-master
cc5124
	sudo $SCRIPT /build/script/common/manager.sh clean_before_do install_release opentoonz-appimage
17be73
	local DIR="$PACKET_BUILD_DIR/$PLATFORM/opentoonz-appimage/install_release"
17be73
	local VERSION_FILE="$PACKET_BUILD_DIR/$PLATFORM/opentoonz-appimage/envdeps_release/version-opentoonz-master"
17be73
	local VERSION=`cat "$VERSION_FILE" | cut -d'-' -f 1`
17be73
	local COMMIT=`cat "$VERSION_FILE" | cut -d'-' -f 2-`
6abdee
	COMMIT="${COMMIT:0:5}"
6abdee
	local DATE=`date -u +%Y.%m.%d`
ec0475
	if [ -z "$COMMIT" ]; then
ec0475
		echo "Cannot find version, pheraps appimage not ready. Cancel."
ec0475
		return 1
ec0475
	fi
5b31b7
	if ! ls $PUBLISH_DIR/OpenToonz-$VERSION-*-$COMMIT-$PLATFORM_SUFFIX.appimage 1> /dev/null 2>&1; then
ec0475
		echo "Publish new version $VERSION-$COMMIT-$PLATFORM_SUFFIX"
a120ef
		rm -f $PUBLISH_DIR/OpenToonz-*-$PLATFORM_SUFFIX.appimage
5b31b7
		cp $DIR/opentoonz.appimage $PUBLISH_DIR/OpenToonz-$VERSION-$DATE-$COMMIT-$PLATFORM_SUFFIX.appimage
32f8ef
		if [ -f "$PUBLISH_DIR/publish-opentoonz.sh" ]; then
32f8ef
			"$PUBLISH_DIR/publish-opentoonz.sh" "$PUBLISH_DIR/OpenToonz-$VERSION-$DATE-$COMMIT-$PLATFORM_SUFFIX.appimage"
a120ef
		fi
ec0475
	else
ec0475
		echo "Version $VERSION-$COMMIT-$PLATFORM_SUFFIX already published"
6abdee
	fi
6abdee
}
cc5124
9051fb
if [ -z "$1" ] || [ -z "$2" ]; then
cc5124
export ARCH=64
cc5124
run "$BASE_DIR/docker/run.sh" "linux-x64"
cc5124
export ARCH=32
cc5124
run "$BASE_DIR/docker/run.sh" "linux-i386"
9051fb
else
cc5124
export ARCH=$2
cc5124
run "$BASE_DIR/docker/run.sh" "$1"
9051fb
fi