aboutsummaryrefslogtreecommitdiff
path: root/setup/package.sh
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-08-09 11:11:18 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-08-09 11:11:18 +1200
commita47360b0da3856a54e027f8e1d415fb72c0016e6 (patch)
tree5d20dad8d048fd36ae2c9b59f0e863db53c62113 /setup/package.sh
parent192d73d617601a8d9a6100537497ecda56c734ca (diff)
downloadtrackermap-server-a47360b0da3856a54e027f8e1d415fb72c0016e6.tar.gz
trackermap-server-a47360b0da3856a54e027f8e1d415fb72c0016e6.tar.bz2
trackermap-server-a47360b0da3856a54e027f8e1d415fb72c0016e6.zip
Update setup package script
Diffstat (limited to 'setup/package.sh')
-rwxr-xr-xsetup/package.sh261
1 files changed, 115 insertions, 146 deletions
diff --git a/setup/package.sh b/setup/package.sh
index d4deed401..45facba5a 100755
--- a/setup/package.sh
+++ b/setup/package.sh
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# Shell script to create installers
+# Script to create installers
#
cd $(dirname $0)
@@ -12,185 +12,154 @@ then
exit 1
fi
-# GENERAL REQUIREMENTS
+VERSION=$1
-# Check wrapper
-if ! ls wrapper-delta-pack-*.tar.gz &>/dev/null
-then
- echo "Missing wrapper-delta-pack-*.tar.gz (http://wrapper.tanukisoftware.com/doc/english/download.jsp)"
- exit 1
-fi
-
-# Check Windows x64 wrapper
-if ! ls wrapper-windows-x86-64-*.zip &>/dev/null
-then
- echo "Missing wrapper-windows-x86-64-*.zip (http://www.krenger.ch/blog/tag/java-service-wrapper/)"
- exit 1
-fi
-
-# WINDOWS REQUIREMENTS
-
-# Check inno setup
-if ! ls isetup-*.exe &>/dev/null
-then
- echo "Missing isetup-*.exe (http://www.jrsoftware.org/isdl.php)"
- exit 1
-fi
-
-# Check wine
-if ! which wine &>/dev/null
-then
- echo "Missing wine package"
- exit 1
-fi
-
-# Check innoextract
-if ! which innoextract &>/dev/null
-then
- echo "Missing innoextract package"
- exit 1
-fi
-
-# LINUX REQUIREMENTS
-
-# Check makeself
-if ! which makeself &>/dev/null
-then
- echo "Install makeself package"
- exit 1
-fi
-
-# GENERAL PREPARATION
-
-tar -xzf wrapper-delta-pack-*.tar.gz
-mv wrapper-delta-pack-*/ wrapper/
-
-../tools/minify.sh
-
-# UNIVERSAL PACKAGE
-
-zip -j tracker-server-$1.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.5.5 (or check what versions are supported by 'innoextract -v')"
-
-# windows 32
-
-wine app/ISCC.exe windows/traccar.iss
-
-zip -j traccar-windows-32-$1.zip windows/Output/setup.exe windows/README.txt
+check_requirement () {
+ eval $1 &>/dev/null
+ if ! eval $1 &>/dev/null
+ then
+ echo $2
+ exit 1
+ fi
+}
-rm -rf windows/Output/
-rm -rf tmp/
+check_requirement "ls wrapper-delta-pack-*.tar.gz" "Missing wrapper-delta-pack-*.tar.gz (http://wrapper.tanukisoftware.com/doc/english/download.jsp)"
+check_requirement "ls wrapper-windows-x86-64-*.zip" "Missing wrapper-windows-x86-64-*.zip (http://www.krenger.ch/blog/tag/java-service-wrapper/)"
+check_requirement "ls isetup-*.exe" "Missing isetup-*.exe (http://www.jrsoftware.org/isdl.php)"
+check_requirement "which wine" "Missing wine package"
+check_requirement "which innoextract" "Missing innoextract package"
+check_requirement "which makeself" "Missing makeself package"
-# windows 64
+prepare () {
-unzip wrapper-windows-x86-64-*.zip
-cp wrapper_*_src/bin/wrapper.exe wrapper/bin/wrapper-windows-x86-32.exe
-cp wrapper_*_src/lib/wrapper.dll wrapper/lib/wrapper-windows-x86-32.dll
-cp wrapper_*_src/lib/wrapper.jar wrapper/lib/wrapper.jar
-rm -rf wrapper_*_src
+ tar -xzf wrapper-delta-pack-*.tar.gz
+ mv wrapper-delta-pack-*/ wrapper/
-wine app/ISCC.exe windows/traccar.iss
+ ../tools/minify.sh
-zip -j traccar-windows-64-$1.zip windows/Output/setup.exe windows/README.txt
+ innoextract isetup-*.exe
+ echo "If you got any errors here try isetup version 5.5.5 (or check what versions are supported by 'innoextract -v')"
+}
-rm -rf windows/Output/
-rm -rf tmp/
+cleanup () {
-rm -rf app/
+ rm -rf wrapper/
-# LINIX PACKAGE
+ rm ../web/app.min.js
-app='/opt/traccar'
+ rm -rf app/
+}
-rm -rf out
+prepare_windows_64 () {
+ unzip wrapper-windows-x86-64-*.zip
+ cp wrapper_*_src/bin/wrapper.exe wrapper/bin/wrapper-windows-x86-32.exe
+ cp wrapper_*_src/lib/wrapper.dll wrapper/lib/wrapper-windows-x86-32.dll
+ cp wrapper_*_src/lib/wrapper.jar wrapper/lib/wrapper.jar
+ rm -rf wrapper_*_src
+}
-mkdir out
-mkdir out/bin
-mkdir out/conf
-mkdir out/data
-mkdir out/lib
-mkdir out/logs
-mkdir out/web
+prepare_linux_32 () {
+ cp unix/setup.sh out
+ cp wrapper/bin/wrapper-linux-x86-32 out/bin/wrapper
+ cp wrapper/lib/libwrapper-linux-x86-32.so out/lib/libwrapper.so
+}
-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
+prepare_linux_64 () {
+ cp unix/setup.sh out
+ cp wrapper/bin/wrapper-linux-x86-64 out/bin/wrapper
+ cp wrapper/lib/libwrapper-linux-x86-64.so out/lib/libwrapper.so
+}
-sed -i 's/tail -1/tail -n 1/g' out/bin/traccar
-chmod +x out/bin/traccar
+prepare_linux_arm () {
+ cp unix/linux-arm-setup.sh out/setup.sh
+ cp wrapper/bin/wrapper-linux-armel-32 out/bin
+ cp wrapper/bin/wrapper-linux-armhf-32 out/bin
+ cp wrapper/lib/libwrapper-linux-armel-32.so out/lib
+ cp wrapper/lib/libwrapper-linux-armhf-32.so out/lib
+}
-cp ../target/tracker-server.jar out
-cp ../target/lib/* out/lib
-cp -r ../web/* out/web
-cp linux/traccar.xml out/conf
+prepare_macosx_64 () {
+ cp unix/setup.sh out
+ cp wrapper/bin/wrapper-macosx-universal-64 out/bin/wrapper
+ cp wrapper/lib/libwrapper-macosx-universal-64.jnilib out/lib/libwrapper.jnilib
+}
-sed -i 's/@app.name@/traccar/g' out/bin/traccar
-sed -i 's/@app.long.name@/traccar/g' out/bin/traccar
+package_windows () {
-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/traccar.xml" 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
-sed -i 's/wrapper.logfile=..\/logs\/wrapper.log/wrapper.logfile=..\/logs\/wrapper.log.YYYYMMDD\nwrapper.logfile.rollmode=DATE/g' out/conf/wrapper.conf
+ if [ "$#" -gt 1 ]
+ then
+ eval $2
+ fi
-# linux 32
+ wine app/ISCC.exe windows/traccar.iss
-cp wrapper/bin/wrapper-linux-x86-32 out/bin/wrapper
-cp wrapper/lib/libwrapper-linux-x86-32.so out/lib/libwrapper.so
+ zip -j traccar-$1-$VERSION.zip windows/Output/setup.exe README.txt
-makeself out traccar.run "traccar" "if [ $(java -version 2>&1 | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -lt 17 ]; then echo "Please install Java version 7 or higher"; else mkdir $app; cp -rf * $app; $app/bin/traccar install; fi"
-zip -j traccar-linux-32-$1.zip traccar.run linux/README.txt
+ rm -rf windows/Output/
+ rm -rf tmp/
+}
-# linux 64
+package_unix () {
-cp wrapper/bin/wrapper-linux-x86-64 out/bin/wrapper
-cp wrapper/lib/libwrapper-linux-x86-64.so out/lib/libwrapper.so
+ mkdir -p out/{bin,conf,data,lib,logs,web}
-makeself out traccar.run "traccar" "if [ $(java -version 2>&1 | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -lt 17 ]; then echo "Please install Java version 7 or higher"; else mkdir $app; cp -rf * $app; $app/bin/traccar install; fi"
-zip -j traccar-linux-64-$1.zip traccar.run linux/README.txt
+ 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
-# linux arm
+ sed -i 's/tail -1/tail -n 1/g' out/bin/traccar
+ chmod +x out/bin/traccar
-rm out/bin/wrapper
-rm out/lib/libwrapper.so
+ cp ../target/tracker-server.jar out
+ cp ../target/lib/* out/lib
+ cp -r ../web/* out/web
+ cp unix/traccar.xml out/conf
-cp wrapper/bin/wrapper-linux-armel-32 out/bin/
-cp wrapper/bin/wrapper-linux-armhf-32 out/bin/
-cp wrapper/lib/libwrapper-linux-armel-32.so out/lib/
-cp wrapper/lib/libwrapper-linux-armhf-32.so out/lib/
+ sed -i 's/@app.name@/traccar/g' out/bin/traccar
+ sed -i 's/@app.long.name@/traccar/g' out/bin/traccar
-makeself out traccar.run "traccar" "if [ $(java -version 2>&1 | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -lt 17 ]; then echo "Please install Java version 7 or higher"; else mkdir $app; cp -rf * $app; if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ]; then mv $app/bin/wrapper-linux-armel-32 $app/bin/wrapper; mv $app/lib/libwrapper-linux-armel-32.so $app/lib/libwrapper.so; else mv $app/bin/wrapper-linux-armhf-32 $app/bin/wrapper; mv $app/lib/libwrapper-linux-armhf-32.so $app/lib/libwrapper.so; fi; $app/bin/traccar install; fi"
-zip -j traccar-linux-arm-$1.zip traccar.run linux/README.txt
+ 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=../conf/traccar.xml' 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
+ sed -i 's/wrapper.logfile=..\/logs\/wrapper.log/wrapper.logfile=..\/logs\/wrapper.log.YYYYMMDD\nwrapper.logfile.rollmode=DATE/g' out/conf/wrapper.conf
-# MACOSX PACKAGE
+ eval $2
-rm out/conf/traccar.xml
-rm out/bin/wrapper-linux-armel-32
-rm out/bin/wrapper-linux-armhf-32
-rm out/lib/libwrapper-linux-armel-32.so
-rm out/lib/libwrapper-linux-armhf-32.so
+ makeself out traccar.run "traccar" ./setup.sh
+ zip -j traccar-$1-$VERSION.zip traccar.run README.txt
-cp macosx/traccar.xml out/conf
+ rm traccar.run
+ rm -rf out/
+}
-cp wrapper/bin/wrapper-macosx-universal-64 out/bin/wrapper
-cp wrapper/lib/libwrapper-macosx-universal-64.jnilib out/lib/libwrapper.jnilib
+package_universal () {
-makeself out traccar.run "traccar" "mkdir -p $app; cp -rf * $app; $app/bin/traccar install"
-zip -j traccar-macosx-64-$1.zip traccar.run macosx/README.txt
+ mkdir -p out/{conf,data,lib,logs,web}
-rm traccar.run
-rm -rf out
+ cp ../target/tracker-server.jar out
+ cp ../target/lib/* out/lib
+ cp -r ../web/* out/web
+ cp windows/traccar.xml out/conf
+ cp README.txt out
-# GENERAL CLEANUP
+ cd out
+ zip -r ../traccar-$1-$VERSION.zip * README.txt
+ cd ..
-rm -rf wrapper/
+ rm -rf out/
+}
+
+prepare
-rm ../web/app.min.js
+package_windows "windows-32"
+package_windows "windows-64" "prepare_windows_64"
+package_unix "linux-32" "prepare_linux_32"
+package_unix "linux-64" "prepare_linux_64"
+package_unix "linux-arm" "prepare_linux_arm"
+package_unix "macosx-64" "prepare_macosx_64"
+package_universal "other"
-exit 0
+cleanup