summaryrefslogtreecommitdiff
path: root/trunk/users/hoeken/gcode-host-old/host-package-release
blob: 3ecfa8bda88f3b5ee480d7a9c1559cdd93eff041 (plain)
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
#!/bin/bash
# host-package-release -- Packages Reprap host software into a .zip file

# init
RELEASE=${1:-`date -u +%Y%m%d`}
FILENAME="reprap-host-$RELEASE"
FILELIST="jar/reprap.jar lib/reprap-wv.stl \
    reprap-host.sh reprap-host reprap-host.bat LICENSE"

SRCFILENAME="reprap-host-src-$RELEASE"
SRCFILELIST="src/* LICENSE build.xml build-user.xml .classpath .project \
	host-package-release README"
LIBFILES="lib/*"

# Remove any old jar directory
[ -d jar ] && rm -rf jar

# Recompile java files and create Reprap.jar
ant clean jar || exit 1

# Delete and then create temporary package directories
rm -rf "$FILENAME" "$SRCFILENAME"
mkdir "$FILENAME" "$SRCFILENAME"

# Copy files into binary package directory
for F in $FILELIST
do
  cp -p $F $FILENAME
done

# Copy README into package dir, substituting release string for RELEASE
#   and the current UTC date for DATE
NOW=`date -u +'%d %B %Y'`
sed -e "s/RELEASE/$RELEASE/g" -e "s/DATE/$NOW/g" README >$FILENAME/README
# Create README.txt for Windows people
sed -e 's/$/\r/' $FILENAME/README >$FILENAME/README.txt

# Copy Main class file, so we can use java -cp to run software
mkdir -p $FILENAME/org/reprap
cp -p bin/org/reprap/Main.class $FILENAME/org/reprap/

# Create zip archive
[ -f "$FILENAME".zip ] && rm "$FILENAME".zip
zip -qr "$FILENAME.zip" "$FILENAME"

echo "RepRap Host Software Release $RELEASE created as ${FILENAME}.zip"

# Now create the src archive
for F in $SRCFILELIST
do
  cp -rp $F $SRCFILENAME
done

mkdir -p "$SRCFILENAME"/lib
for F in $LIBFILES
do
  cp -pr $F "$SRCFILENAME"/lib
done

# Omit all .svn subdirs
find $SRCFILENAME -type d -name .svn |xargs rm -rf

# Create src zip archive
[ -f "$SRCFILENAME".zip ] && rm "$SRCFILENAME".zip
zip -qr "$SRCFILENAME.zip" "$SRCFILENAME"

echo "RepRap Host Software source Release $RELEASE created as ${SRCFILENAME}.zip"

# Cleanup
rm -rf "$FILENAME" "$SRCFILENAME"