Statistiques
| Révision :

root / tmp / org.txm.setups / pushTXMUpdateToGIT.sh @ 3030

Historique | Voir | Annoter | Télécharger (1,08 ko)

1 3027 mdecorde
#!/bin/bash
2 3027 mdecorde
3 3027 mdecorde
if [ ! $# -eq 2 ]
4 3027 mdecorde
  then
5 3027 mdecorde
    echo "** Error: called with $# args. usage: 'pushTXMUpdateToGIT.sh VERSION LEVEL'"
6 3027 mdecorde
    echo "** eg ./pushTXMUpdateToGIT.sh 0.8.1 alpha"
7 3027 mdecorde
    exit 1
8 3027 mdecorde
fi
9 3027 mdecorde
10 3027 mdecorde
CURRENTPATH="$(dirname $(realpath $0))"
11 3027 mdecorde
echo "PATH='$PATH'"
12 3027 mdecorde
VERSION=$1
13 3027 mdecorde
14 3027 mdecorde
LEVEL=$2
15 3027 mdecorde
LEVEL="${LEVEL,,}"
16 3027 mdecorde
TXMGITROOT=~/GIT/txm-software
17 3027 mdecorde
TXMGITLOCAL="dist/$VERSION/main/$LEVEL"
18 3027 mdecorde
TXMGIT=$TXMGITROOT/$TXMGITLOCAL
19 3027 mdecorde
20 3027 mdecorde
if [ ! -d "$TXMGIT" ]; then
21 3027 mdecorde
	echo "** Error the GIT directory does not exists: $TXMGIT"
22 3027 mdecorde
	exit 1;
23 3027 mdecorde
fi
24 3027 mdecorde
25 3027 mdecorde
if [ ! -d "$CURRENTPATH/exportRCP/repository" ]; then
26 3027 mdecorde
	echo "** Error: no TXM repository build found: $CURRENTPATH/exportRCP/repository"
27 3027 mdecorde
	exit 1;
28 3027 mdecorde
fi
29 3027 mdecorde
30 3027 mdecorde
echo "Preparing GIT push..."
31 3027 mdecorde
pushd $TXMGIT
32 3027 mdecorde
33 3027 mdecorde
if [ -z "$(git status --porcelain $TXMGIT)" ]; then
34 3027 mdecorde
	echo "GIT OK"
35 3027 mdecorde
else
36 3027 mdecorde
	echo "Aborting GIT push: $TXMGIT repository is not clean."
37 3027 mdecorde
	popd
38 3027 mdecorde
	exit 1
39 3027 mdecorde
fi
40 3027 mdecorde
41 3027 mdecorde
git rm -r $TXMGITLOCAL/binary/*
42 3027 mdecorde
git rm -r $TXMGITLOCAL/features/*
43 3027 mdecorde
git rm -r $TXMGITLOCAL/plugins/*
44 3027 mdecorde
45 3027 mdecorde
cp -rf $CURRENTPATH/exportRCP/repository/* $TXMGITLOCAL
46 3027 mdecorde
47 3027 mdecorde
git add --all $TXMGITLOCAL
48 3027 mdecorde
git commit -m "push $LEVEL update of TXM-$VERSION"
49 3027 mdecorde
git push
50 3027 mdecorde
51 3027 mdecorde
popd
52 3027 mdecorde
53 3027 mdecorde
echo "Done."