Statistics
| Revision:

root / tmp / org.txm.setups / PublishTXMUpdateSite.sh @ 2777

History | View | Annotate | Download (1.4 kB)

1 728 mdecorde
#!/bin/bash
2 728 mdecorde
3 728 mdecorde
echo "Sending RCP export to update site..."
4 728 mdecorde
5 728 mdecorde
UPDATESITE="$HOME/workspace079/org.txm.setups/exportRCP/repository"
6 728 mdecorde
# UPDATE THIS MOUNT PATH TO YOURS
7 728 mdecorde
SERVERPATH="/run/user/1001/gvfs/sftp:host=vm-web-preprod.pun.ens-lyon.fr,user=mdecorde"
8 728 mdecorde
DISTANTPATH="$SERVERPATH/textometrie/dist/main/"
9 728 mdecorde
10 728 mdecorde
if [ "$1" = "" ] ; then
11 728 mdecorde
	echo "You need to specify the update site level to update"
12 728 mdecorde
	exit 1
13 728 mdecorde
elif [[ $1 =~ alpha|beta|dev ]] ; then
14 728 mdecorde
	echo "Uploading to the '$1' dist/main repository"
15 728 mdecorde
	DISTANTPATH="$SERVERPATH/textometrie/dist/main/"
16 728 mdecorde
else
17 728 mdecorde
	echo "Uploading to the '$1' project update site repository"
18 728 mdecorde
	DISTANTPATH="$SERVERPATH/textometrie/dist/"
19 728 mdecorde
fi
20 728 mdecorde
21 728 mdecorde
if [ ! -d "$UPDATESITE" ]; then
22 728 mdecorde
	echo "** $UPDATESITE is missing."
23 728 mdecorde
	exit 1;
24 728 mdecorde
fi
25 728 mdecorde
26 728 mdecorde
# DO IT !
27 728 mdecorde
echo "ls" > pushFilesToPreprod.ftp
28 728 mdecorde
echo "exit" > pushFilesToPreprod.ftp
29 728 mdecorde
30 728 mdecorde
echo "Remove old files"
31 728 mdecorde
rm -rf "$DISTANTPATH$1/"*
32 728 mdecorde
if [ $? != 0 ]; then
33 728 mdecorde
    echo "Could not delete files of $DISTANTPATH$1";
34 728 mdecorde
    exit 1 ;
35 728 mdecorde
fi
36 728 mdecorde
37 728 mdecorde
echo "Copy new files"
38 728 mdecorde
mkdir "$DISTANTPATH"
39 728 mdecorde
mkdir "$DISTANTPATH$1"
40 728 mdecorde
cp -rf "$UPDATESITE/"* "$DISTANTPATH$1"
41 728 mdecorde
if [ $? != 0 ]; then
42 728 mdecorde
    echo "Could not copy files of $UPDATESITE to $DISTANTPATH$1";
43 728 mdecorde
    exit 1 ;
44 728 mdecorde
fi
45 728 mdecorde
46 728 mdecorde
echo "Rename commandes-succes.txt file"
47 728 mdecorde
mv "$SERVERPATH/commandes-succes.txt" "$SERVERPATH/commandes.txt"
48 728 mdecorde
if [ $? != 0 ]; then
49 728 mdecorde
    echo "Could not rename commandes-succes.txt file";
50 728 mdecorde
    exit 1 ;
51 728 mdecorde
fi
52 728 mdecorde
53 728 mdecorde
echo "$1 update site updated"