forked from hightman/xunsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dist-sh
executable file
·51 lines (46 loc) · 1.73 KB
/
dist-sh
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
#!/bin/sh
# $Id: $
# Distribute hook script, run by make automatically
# get fileinfo & version
fileinfo=
filetype=BETA
devel=`cat config.h | grep PACKAGE_VERSION | cut -d \" -f 2 | grep "dev$"`
if test -z "$devel" ; then
fileinfo=`cat VERSION`
git tag $fileinfo -a -m "Release: $fileinfo"
if test $? -ne 0 ; then
exit -1
fi
fileinfo2=`echo $fileinfo | sed 's/[a-zA-Z]//g'`
if test "$fileinfo" = "$fileinfo2" ; then
filetype=RELEASE
fi
else
fileinfo=dev
fi
# make tar ball
echo "Creating package file: xunsearch-full-$fileinfo ..."
ln -s xunsearch-full xunsearch-full-$fileinfo
tar -cHjf xunsearch-full-$fileinfo.tar.bz2 xunsearch-full-$fileinfo
rm -f xunsearch-full-$fileinfo
# upload to web server
echo "Uploading file to web server ($filetype) ..."
if test "$fileinfo" = "dev" ; then
scp xunsearch-full-$fileinfo.tar.bz2 xunsearch:./web/download
scp xunsearch-full/packages/xunsearch-sdk-*-dev.zip xunsearch:./web/download/xunsearch-sdk-dev.zip
scp VERSION xunsearch:./web/protected/data
else
scp xunsearch-full-$fileinfo.tar.bz2 xunsearch:./web/download/xunsearch-full
if test "$filetype" = "RELEASE" ; then
ssh xunsearch ln -sf xunsearch-full/xunsearch-full-$fileinfo.tar.bz2 ./web/download/xunsearch-full-latest.tar.bz2
scp xunsearch-full/packages/xunsearch-sdk-$fileinfo.zip xunsearch:./web/download/xunsearch-sdk-latest.zip
fi
scp VERSION xunsearch:./web/protected/data/$filetype
# also update dev
scp xunsearch-full-$fileinfo.tar.bz2 xunsearch:./web/download/xunsearch-full-dev.tar.bz2
scp xunsearch-full/packages/xunsearch-sdk-$fileinfo.zip xunsearch:./web/download/xunsearch-sdk-dev.zip
scp VERSION xunsearch:./web/protected/data
fi
# clean local file
rm -f xunsearch-full-$fileinfo.tar.bz2
exit 0