releaseKT.sh
1.64 KB
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
#!/bin/sh
#
# script to checkout the latest tagged build from cvs and upload
# to the remote server of your choice
## functions
# displays the script usage message
#
usage() {
echo "usage: `basename $0` -b branch -v version"
echo " eg. `basename $0` -b BRANCH_1_0_1_20030728 -v 1.1.2"
exit 1
}
deploy() {
# cleanup
rm -rf $tmp 2> /dev/null
mkdir $tmp
# export kt
cd $tmp
cvs -d $cvsroot co -r $branch -N knowledgeTree
cvs -d $cvsroot co -r $branch -N "knowledgeTree/Documents/Root Folder/Default Unit"
find . -name CVS -exec rm -rf {} \; 2> /dev/null
# tar it up
rm /tmp/knowledgeTree-$version.tgz 2> /dev/null
tar -czvf /tmp/knowledgeTree-$version.tgz knowledgeTree
# convert src to windoze line-endings
find $tmp/knowledgeTree -name \*\.php -exec unix2dos {} \; 2> /dev/null
find $tmp/knowledgeTree -name \*\.inc -exec unix2dos {} \; 2> /dev/null
find $tmp/knowledgeTree -name \*\.txt -exec unix2dos {} \; 2> /dev/null
# zip it up
rm /tmp/knowledgeTree-$version.zip 2> /dev/null
zip -r /tmp/knowledgeTree-$version.zip knowledgeTree
# move them to this dir
cd -
mv /tmp/knowledgeTree-$version.* .
# clean up
rm -rf $tmp 2> /dev/null
}
# check the command line options
if [ $# -lt 2 ]; then
usage
fi
# process the params
while getopts ":b:v:" Option
do
case $Option in
b ) branch=$OPTARG;;
v ) version=$OPTARG;;
* ) usage;;
esac
done
# check that everything we want is set
if [ -z $branch -o -z $version ]; then
usage
fi
# setup up some paths and stuff
cvsroot=/usr/local/cvsroot
tmp=/tmp/dms
# now just do it
deploy