aboutsummaryrefslogtreecommitdiff
path: root/setup/package.sh
blob: ed897c201225abce16a568c68cb7182ecb021aa0 (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
#!/bin/bash

#
# Script to create installers
#

cd $(dirname $0)

if [[ $# -lt 1 ]]
then
  echo "USAGE: $0 <version>"
  exit 1
fi

VERSION=$1

check_requirement () {
  if ! eval $1 &>/dev/null
  then
    echo $2
    exit 1
  fi 
}

check_requirement "ls ../../ext-6.2.0" "Missing ../../ext-6.2.0 (https://www.sencha.com/legal/GPL/)"
check_requirement "ls innosetup-*.exe" "Missing isetup-*.exe (http://www.jrsoftware.org/isdl.php)"
check_requirement "which sencha" "Missing sencha cmd package (https://www.sencha.com/products/extjs/cmd-download/)"
check_requirement "which wine" "Missing wine package"
check_requirement "which innoextract" "Missing innoextract package"
check_requirement "which makeself" "Missing makeself package"

prepare () {
  ../traccar-web/tools/minify.sh

  innoextract innosetup-*.exe
  echo "If you got any errors here try isetup version 5.5.5 (or check supported versions using 'innoextract -v')"
}

cleanup () {
  rm ../traccar-web/web/app.min.js

  rm -r app/
}

copy_files () {
  cp ../target/tracker-server.jar out
  cp ../target/lib/* out/lib
  cp ../schema/* out/schema
  cp -r ../templates/* out/templates
  cp -r ../traccar-web/web/* out/web
  cp default.xml out/conf
  cp traccar.xml out/conf
}

package_windows () {
  mkdir -p out/{conf,data,lib,logs,web,schema,templates}

  copy_files

  wine app/ISCC.exe traccar.iss

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

  rm -r Output
  rm -r tmp
  rm -r out
}

package_unix () {
  mkdir -p out/{conf,data,lib,logs,web,schema,templates}
  copy_files

  cp java-test/test.jar out
  cp setup.sh out
  cp other/traccar.service out
  makeself --notemp out traccar.run "traccar" ./setup.sh

  zip -j traccar-linux-$VERSION.zip traccar.run README.txt

  rm traccar.run
  rm -r out
}

package_universal () {
  mkdir -p out/{conf,data,lib,logs,web,schema,templates}

  copy_files

  cp README.txt out

  cd out
  zip -r ../traccar-other-$VERSION.zip *
  cd ..

  rm -rf out/
}

prepare

package_windows
package_unix
package_universal

cleanup