#!/bin/bash

# Copyright (C) 2010-2011 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#
# Python X2go is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Python X2go is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

# Thanks to Jonas Smedegaard <dr@jones.dk> for inspiration...

set -e

for pkg in "$@"; do
	ssh -lx2go code.x2go.org "cd /srv/git/code.x2go.org && ./setup-repository $pkg '$pkg upstream project'"
	ssh -lx2go-admin code.x2go.org "cd /srv/git/code.x2go.org && ./update-repository-posixacls $pkg"
	cd "$pkg"
	echo "$pkg: MASTER BRANCH" && git push ssh://x2go@code.x2go.org:32032/srv/git/code.x2go.org/$pkg master 
	#echo "$pkg: RELEASE BRANCH" && git push ssh://x2go@code.x2go.org:32032/srv/git/code.x2go.org/$pkg release
	#echo "$pkg: PRISTINE-TAR" && git push ssh://x2go@code.x2go.org:32032/srv/git/code.x2go.org/$pkg pristine-tar
	echo "$pkg: PUSHING TAGS" && git push --tags ssh://x2go@code.x2go.org:32032/srv/git/code.x2go.org/$pkg
	git remote add ssh://x2go@code.x2go.org:32032/srv/git/code.x2go.org/$pkg
	cd ..
done
