aboutsummaryrefslogtreecommitdiff
path: root/setup/package.sh
blob: ac0f021a89bd3f2d5fa238e050fb4c9a7e8a7d34 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/sh

# GENERAL REQUIREMENTS

# Check web application
if [ -e "traccar-web.war" ]; then
    echo "Web application archive found"
else
    echo "Put traccar-web.war into this directory"
    exit 0
fi

# Check wrapper
if ls wrapper-delta-pack-*.tar.gz &> /dev/null; then
    echo "Java wrapper package found"
else
    echo "Put wrapper-delta-pack-*.tar.gz into this directory"
    exit 0
fi

# WINDOWS REQUIREMENTS

# Check inno setup
if ls isetup-*.exe &> /dev/null; then
    echo "Inno setup installer found"
else
    echo "Put isetup-*.exe into this directory"
    exit 0
fi

# Check wine
if which wine > /dev/null; then
    echo "Found wine"
else
    echo "Install wine package"
    exit 0
fi

# Check innoextract
if which innoextract > /dev/null; then
    echo "Found Innoextract"
else
    echo "Install innoextract package"
    exit 0
fi

# LINUX REQUIREMENTS

# Check makeself
if which makeself > /dev/null; then
    echo "Found makeself"
else
    echo "Install makeself package"
    exit 0
fi

# GENERAL PREPARATION

tar -xzf wrapper-delta-pack-*.tar.gz
mv wrapper-delta-pack-*/ wrapper/

# UNIVERSAL PACKAGE

zip -j tracker-server.zip ../target/tracker-server.jar universal/README.txt

# WINDOWS PACKAGE

innoextract isetup-*.exe
echo "NOTE: if you got any errors here try isetup version 5.4.3 (or check what versions are supported by 'innoextract -v')"

wine app/ISCC.exe windows/traccar.iss

zip -j traccar-windows-32.zip windows/Output/setup.exe windows/README.txt

rm -rf windows/Output/
rm -rf tmp/
rm -rf app/

# LINIX PACKAGE

app='/opt/traccar'

rm -rf out

mkdir out
mkdir out/bin
mkdir out/conf
mkdir out/data
mkdir out/lib
mkdir out/logs

cp wrapper/src/bin/sh.script.in out/bin/traccar
cp wrapper/lib/wrapper.jar out/lib
cp wrapper/src/conf/wrapper.conf.in out/conf/wrapper.conf

cp ../target/tracker-server.jar out
cp ../target/lib/* out/lib
cp traccar-web.war out
cp linux/linux.cfg out/conf

sed -i 's/@app.name@/traccar/g' out/bin/traccar
sed -i 's/@app.long.name@/traccar/g' out/bin/traccar

sed -i '/wrapper.java.classpath.1/i\wrapper.java.classpath.2=../tracker-server.jar' out/conf/wrapper.conf
sed -i "/wrapper.app.parameter.1/i\wrapper.app.parameter.2=$app/conf/linux.cfg" out/conf/wrapper.conf
sed -i 's/<YourMainClass>/org.traccar.Main/g' out/conf/wrapper.conf
sed -i 's/@app.name@/traccar/g' out/conf/wrapper.conf
sed -i 's/@app.long.name@/traccar/g' out/conf/wrapper.conf
sed -i 's/@app.description@/traccar/g' out/conf/wrapper.conf

# linux 32

cp wrapper/bin/wrapper-linux-x86-32 out/bin/wrapper
cp wrapper/lib/libwrapper-linux-x86-32.so out/lib/libwrapper.so
chmod +x out/bin/traccar

makeself out traccar.run "traccar" "mkdir $app; cp -rf * $app; $app/bin/traccar install"
zip -j traccar-linux-32.zip traccar.run linux/README.txt

# linux 64

cp wrapper/bin/wrapper-linux-x86-64 out/bin/wrapper
cp wrapper/lib/libwrapper-linux-x86-64.so out/lib/libwrapper.so
chmod +x out/bin/traccar

makeself out traccar.run "traccar" "mkdir $app; cp -rf * $app; $app/bin/traccar install"
zip -j traccar-linux-64.zip traccar.run linux/README.txt

rm traccar.run
rm -rf out

# GENERAL CLEANUP

rm -rf wrapper/