2015-08-05 16:01:48 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Shell script to create installers
|
|
|
|
#
|
2013-01-12 07:57:19 +08:00
|
|
|
|
2015-08-01 17:34:28 +08:00
|
|
|
cd $(dirname $0)
|
|
|
|
|
2015-08-05 16:01:48 +08:00
|
|
|
if [[ $# -lt 1 ]]
|
|
|
|
then
|
|
|
|
echo "USAGE: $0 <version>"
|
|
|
|
exit 1
|
2015-01-17 13:52:49 +08:00
|
|
|
fi
|
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
# GENERAL REQUIREMENTS
|
|
|
|
|
|
|
|
# Check wrapper
|
2015-08-05 16:01:48 +08:00
|
|
|
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
|
2013-01-12 07:57:19 +08:00
|
|
|
fi
|
|
|
|
|
2015-02-21 16:05:52 +08:00
|
|
|
# Check Windows x64 wrapper
|
2015-08-05 16:01:48 +08:00
|
|
|
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
|
2015-02-21 16:05:52 +08:00
|
|
|
fi
|
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
# WINDOWS REQUIREMENTS
|
|
|
|
|
|
|
|
# Check inno setup
|
2015-08-05 16:01:48 +08:00
|
|
|
if ! ls isetup-*.exe &>/dev/null
|
|
|
|
then
|
|
|
|
echo "Missing isetup-*.exe (http://www.jrsoftware.org/isdl.php)"
|
|
|
|
exit 1
|
2013-01-12 07:57:19 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Check wine
|
2015-08-05 16:01:48 +08:00
|
|
|
if ! which wine &>/dev/null
|
|
|
|
then
|
|
|
|
echo "Missing wine package"
|
|
|
|
exit 1
|
2013-01-12 07:57:19 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Check innoextract
|
2015-08-05 16:01:48 +08:00
|
|
|
if ! which innoextract &>/dev/null
|
|
|
|
then
|
|
|
|
echo "Missing innoextract package"
|
|
|
|
exit 1
|
2013-01-12 07:57:19 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# LINUX REQUIREMENTS
|
|
|
|
|
|
|
|
# Check makeself
|
2015-08-05 16:01:48 +08:00
|
|
|
if ! which makeself &>/dev/null
|
|
|
|
then
|
|
|
|
echo "Install makeself package"
|
|
|
|
exit 1
|
2013-01-12 07:57:19 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# GENERAL PREPARATION
|
|
|
|
|
|
|
|
tar -xzf wrapper-delta-pack-*.tar.gz
|
|
|
|
mv wrapper-delta-pack-*/ wrapper/
|
|
|
|
|
2015-08-01 18:00:13 +08:00
|
|
|
../tools/minify.sh
|
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
# UNIVERSAL PACKAGE
|
|
|
|
|
2015-01-17 13:52:49 +08:00
|
|
|
zip -j tracker-server-$1.zip ../target/tracker-server.jar universal/README.txt
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
# WINDOWS PACKAGE
|
|
|
|
|
|
|
|
innoextract isetup-*.exe
|
2015-08-05 16:01:48 +08:00
|
|
|
echo "NOTE: if you got any errors here try isetup version 5.5.5 (or check what versions are supported by 'innoextract -v')"
|
2013-01-12 07:57:19 +08:00
|
|
|
|
2015-02-21 17:00:42 +08:00
|
|
|
# windows 32
|
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
wine app/ISCC.exe windows/traccar.iss
|
|
|
|
|
2015-01-17 13:52:49 +08:00
|
|
|
zip -j traccar-windows-32-$1.zip windows/Output/setup.exe windows/README.txt
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
rm -rf windows/Output/
|
|
|
|
rm -rf tmp/
|
2015-02-21 17:00:42 +08:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
wine app/ISCC.exe windows/traccar.iss
|
|
|
|
|
|
|
|
zip -j traccar-windows-64-$1.zip windows/Output/setup.exe windows/README.txt
|
|
|
|
|
|
|
|
rm -rf windows/Output/
|
|
|
|
rm -rf tmp/
|
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
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
|
2015-06-21 09:16:18 +08:00
|
|
|
mkdir out/web
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2013-11-10 15:25:22 +08:00
|
|
|
sed -i 's/tail -1/tail -n 1/g' out/bin/traccar
|
|
|
|
chmod +x out/bin/traccar
|
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
cp ../target/tracker-server.jar out
|
|
|
|
cp ../target/lib/* out/lib
|
2015-06-21 09:29:14 +08:00
|
|
|
cp -r ../web/* out/web
|
2015-06-21 09:16:18 +08:00
|
|
|
cp linux/traccar.xml out/conf
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
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
|
2015-06-21 09:16:18 +08:00
|
|
|
sed -i "/wrapper.app.parameter.1/i\wrapper.app.parameter.2=$app/conf/traccar.xml" out/conf/wrapper.conf
|
2013-01-12 07:57:19 +08:00
|
|
|
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
|
2013-07-30 16:42:02 +08:00
|
|
|
sed -i 's/wrapper.logfile=..\/logs\/wrapper.log/wrapper.logfile=..\/logs\/wrapper.log.YYYYMMDD\nwrapper.logfile.rollmode=DATE/g' out/conf/wrapper.conf
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
# linux 32
|
|
|
|
|
|
|
|
cp wrapper/bin/wrapper-linux-x86-32 out/bin/wrapper
|
|
|
|
cp wrapper/lib/libwrapper-linux-x86-32.so out/lib/libwrapper.so
|
|
|
|
|
2015-07-14 11:11:50 +08:00
|
|
|
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"
|
2015-01-17 13:52:49 +08:00
|
|
|
zip -j traccar-linux-32-$1.zip traccar.run linux/README.txt
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
# linux 64
|
|
|
|
|
|
|
|
cp wrapper/bin/wrapper-linux-x86-64 out/bin/wrapper
|
|
|
|
cp wrapper/lib/libwrapper-linux-x86-64.so out/lib/libwrapper.so
|
|
|
|
|
2015-07-14 11:11:50 +08:00
|
|
|
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"
|
2015-01-17 13:52:49 +08:00
|
|
|
zip -j traccar-linux-64-$1.zip traccar.run linux/README.txt
|
2013-01-12 07:57:19 +08:00
|
|
|
|
2013-03-02 08:18:34 +08:00
|
|
|
# linux arm
|
|
|
|
|
2013-11-10 15:25:22 +08:00
|
|
|
rm out/bin/wrapper
|
|
|
|
rm out/lib/libwrapper.so
|
|
|
|
|
2013-03-02 08:18:34 +08:00
|
|
|
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/
|
|
|
|
|
2015-07-14 11:11:50 +08:00
|
|
|
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"
|
2015-01-17 13:52:49 +08:00
|
|
|
zip -j traccar-linux-arm-$1.zip traccar.run linux/README.txt
|
2013-03-02 08:18:34 +08:00
|
|
|
|
2013-02-09 17:01:47 +08:00
|
|
|
# MACOSX PACKAGE
|
|
|
|
|
2015-06-21 09:16:18 +08:00
|
|
|
rm out/conf/traccar.xml
|
2013-11-10 15:25:22 +08:00
|
|
|
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
|
2013-02-09 17:01:47 +08:00
|
|
|
|
2015-06-21 09:16:18 +08:00
|
|
|
cp macosx/traccar.xml out/conf
|
2013-02-09 17:01:47 +08:00
|
|
|
|
|
|
|
cp wrapper/bin/wrapper-macosx-universal-64 out/bin/wrapper
|
|
|
|
cp wrapper/lib/libwrapper-macosx-universal-64.jnilib out/lib/libwrapper.jnilib
|
|
|
|
|
|
|
|
makeself out traccar.run "traccar" "mkdir -p $app; cp -rf * $app; $app/bin/traccar install"
|
2015-01-17 13:52:49 +08:00
|
|
|
zip -j traccar-macosx-64-$1.zip traccar.run macosx/README.txt
|
2013-02-09 17:01:47 +08:00
|
|
|
|
2013-01-12 07:57:19 +08:00
|
|
|
rm traccar.run
|
2013-11-10 15:25:22 +08:00
|
|
|
rm -rf out
|
2013-01-12 07:57:19 +08:00
|
|
|
|
|
|
|
# GENERAL CLEANUP
|
|
|
|
|
|
|
|
rm -rf wrapper/
|
2015-08-01 18:00:13 +08:00
|
|
|
|
|
|
|
rm ../web/app.min.js
|
2015-08-05 16:01:48 +08:00
|
|
|
|
|
|
|
exit 0
|