-
Notifications
You must be signed in to change notification settings - Fork 0
/
makebeta
108 lines (91 loc) · 2.6 KB
/
makebeta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
#you need to install sshpass (sudo apt-get install sshpass)
#and after installation (first time) ssh to sourceforge so the key is accepted
#ssh [email protected]
DOCUMENT_ROOT="/home/linaro/dev-domoticz"
SVN_SERVER="svn://svn.code.sf.net/p/domoticz/code/trunk"
SVN_UPLOAD_USER="USERNAME"
SVN_UPLOAD_PASSWORD="PASSWORD"
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
OS=`lowercase \`uname -s\``
#KERNEL=`uname -r`
MACH=`uname -m`
archive_file="domoticz_${OS}_${MACH}.tgz"
version_file="version_${OS}_${MACH}.h"
history_file="history_${OS}_${MACH}.txt"
echo "Changing directories to $DOCUMENT_ROOT..."
cd $DOCUMENT_ROOT
# Check the servers revision number:
echo "Checking the server revision..."
SERVER_REVISION=`svn info $SVN_SERVER | grep Revision: | sed 's .\{10\} '`
echo "Server at revision $SERVER_REVISION"
echo "Checking the working copy revision..."
LOCAL_REVISION=`svn info | grep Revision: | sed 's .\{10\} '`
echo "Working copy at revision $LOCAL_REVISION"
if [ "$SERVER_REVISION" -eq "$LOCAL_REVISION" ]
then
echo "Server is up to date. Nothing to do."
# exit 1
fi
echo "Updating to server revision..."
svn update
if [ $? -ne 0 ]
then
echo "svnupdate failed!";
exit 1
fi
cmake -DCMAKE_BUILD_TYPE=Release .
if [ $? -ne 0 ]
then
echo "CMake failed!";
exit 1
fi
make -j 2
if [ $? -ne 0 ]
then
echo "Compilation failed!";
exit 1
fi
echo "Success, making beta...";
cp -f svnversion.h ${version_file}
cp -f History.txt ${history_file}
#Generate the archive
echo "Generating Archive: ${archive_file}..."
if [ -f ${archive_file} ];
then
rm ${archive_file}
fi
if [ -f ${archive_file}.sha256sum ];
then
rm ${archive_file}.sha256sum
fi
tar -zcf ${archive_file} domoticz History.txt License.txt svnversion.h domoticz.sh --exclude .svn www/ scripts/ Config/
if [ $? -ne 0 ]
then
echo "Error creating archive!";
exit 1
fi
echo "Creating checksum file...";
hash="$(sha256sum ${archive_file} | sed -e 's/\s.*$//') update.tgz";
echo $hash > ${archive_file}.sha256sum
if [ ! -f ${archive_file}.sha256sum ];
then
echo "Error creating archive checksum file!";
exit 1
fi
#################################
echo "Uploading to SourceForge...";
sshpass -p ${SVN_UPLOAD_PASSWORD} scp ${archive_file} ${archive_file}.sha256sum ${version_file} ${history_file} ${SVN_UPLOAD_USER}@web.sourceforge.net:/home/project-web/domoticz/htdocs/beta
if [ $? -ne 0 ]
then
echo "Error uploading to SourceForge!";
exit 1
fi
#################################
#cleaning up
rm -f ${version_file}
rm -f ${history_file}
echo "Done!";
exit 0;