-
Notifications
You must be signed in to change notification settings - Fork 6
/
make-distribution.sh
executable file
·58 lines (46 loc) · 1.26 KB
/
make-distribution.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
#!/bin/bash
TRUE=0
FALSE=1
PIGLET_HOME=.
FILES=(target/scala-2.11/piglet.jar
sparklib/target/scala-2.11/sparklib_2.11-*.jar
flinklib/target/scala-2.11/flinklib_2.11-*.jar
common/target/scala-2.11/common_2.11-*.jar
ceplib/target/scala-2.11/ceplib_2.11-*.jar
mapreducelib/target/scala-2.11/mapreduce_2.11-*.jar
script/piglet)
TARGET_DIR=$PIGLET_HOME/piglet-dist
function checkfile {
# echo "checking file $1"
if [ -r $1 ]; then
FEXISTS=TRUE
else
FEXISTS=FALSE
fi
}
if [ -z "$PIGLET_HOME" ]; then
echo "Please set PIGLET_HOME"
exit 1
fi
rm -rf $TARGET_DIR
mkdir $TARGET_DIR
for f in ${FILES[@]}
do
echo -ne "\r copying $f "
sourcefile=$PIGLET_HOME/$f
checkfile $sourcefile
if [ $FEXISTS == TRUE ]; then
# targetfile=$TARGET_DIR/$f
cp --parents $sourcefile $TARGET_DIR
else
echo "File $f does not exist - aborting"
rm -rf $TARGET_DIR
exit 1
fi
done
echo -e "\rcopied files "
echo -n "creating archive..."
tar jcf ${TARGET_DIR}.tar.bz2 ${TARGET_DIR}
echo -e "\rcreated archive at ${TARGET_DIR}.tar.bz2"
echo "cleanup"
rm -rf $TARGET_DIR