-
Notifications
You must be signed in to change notification settings - Fork 10
/
release-exercises.sh
executable file
·66 lines (51 loc) · 1.93 KB
/
release-exercises.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
if [ x$2 = x ] ; then
echo "Please provide version-string parameter (e.g. 2.0.1) and release (e.g. 2.0)"
exit 1
fi;
if [ ! -d export ] ; then
mkdir export || exit 1
fi;
VERSION=$1
RELEASE=$2
#Make sure we start from right branch.
git checkout rtt-$RELEASE-examples || exit 1
#Merge latest changes into solution branch
git checkout rtt-$RELEASE-solution || exit 1
git rebase rtt-$RELEASE-examples || exit 1
#cleanup
rm -rf export/rtt-exercises-$VERSION
rm -f rtt-exercises-$VERSION.tar.gz
#copy over and make sure it's clean.
git archive --format=tar --prefix=orocos-rtt-examples-$VERSION/ HEAD | (cd export && tar xf -)
cd export
cp -a orocos-rtt-examples-$VERSION/rtt-exercises rtt-exercises-$VERSION
cd rtt-exercises-$VERSION
#create solution dir.
#hacky, need to improve this
for dirname in controller-1 hello-1-task-execution hello-2-properties hello-3-dataports hello-4-operations hello-6-scripting; do
cp -a $dirname $dirname-solution
done
# now remove solution from original dirs:
git diff rtt-$RELEASE-examples..rtt-$RELEASE-solution | patch -p2 -R || exit 1
#rename Eclipse project files.
for dirname in controller-1 hello-1-task-execution hello-2-properties hello-3-dataports hello-4-operations hello-6-scripting; do
cd $dirname-solution
sed -i -e "s/$dirname/$dirname-solution/g" .project .cproject || exit 1
cd ..
done
cd ..
tar -cvzf rtt-exercises-$VERSION.tar.gz rtt-exercises-$VERSION
cd ..
echo "Packaging done."
echo "Press a key to copy files to server, Ctrl-C to abort..."
read -s -n1
USER=psoetens
SERVER=ftp.mech.kuleuven.be
SPREFIX=orocos/pub
BRANCH=stable
# Orocos Examples
ssh -l$USER $SERVER "mkdir -p $SPREFIX/$BRANCH/examples/rtt/tutorial" || exit 1
scp export/rtt-exercises-$VERSION.tar.gz $USER@$SERVER:$SPREFIX/$BRANCH/examples/rtt/tutorial || exit 1
scp export/rtt-exercises-$VERSION/README $USER@$SERVER:$SPREFIX/$BRANCH/examples/rtt/tutorial/README.txt || exit 1
echo "Copied files to $SERVER. Done!"