diff options
Diffstat (limited to 'setup/package.sh')
-rwxr-xr-x | setup/package.sh | 167 |
1 files changed, 74 insertions, 93 deletions
diff --git a/setup/package.sh b/setup/package.sh index 928a6e5b1..41393fa6b 100755 --- a/setup/package.sh +++ b/setup/package.sh @@ -23,8 +23,7 @@ check_requirement () { } check_requirement "ls ../../ext-6.0.1" "Missing ../../ext-6.0.1 (https://www.sencha.com/legal/GPL/)" -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 yajsw-*.zip" "Missing yajsw-*.zip (http://yajsw.sourceforge.net/)" 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" @@ -32,131 +31,117 @@ check_requirement "which innoextract" "Missing innoextract package" check_requirement "which makeself" "Missing makeself package" prepare () { - - tar -xzf wrapper-delta-pack-*.tar.gz - mv wrapper-delta-pack-*/ wrapper/ + unzip yajsw-*.zip + mv yajsw-*/ yajsw/ ../tools/minify.sh innoextract innosetup-*.exe - echo "If you got any errors here try isetup version 5.5.5 (or check what versions are supported by 'innoextract -v')" + echo "If you got any errors here try isetup version 5.5.5 (or check supported versions using 'innoextract -v')" } cleanup () { - - rm -rf wrapper/ + rm -r yajsw/ rm ../web/app.min.js - rm -rf app/ + rm -r app/ } -prepare_windows_64 () { - unzip wrapper-windows-x86-64-*.zip - cp wrapper-windows-*/bin/wrapper.exe wrapper/bin/wrapper-windows-x86-32.exe - cp wrapper-windows-*/lib/wrapper.dll wrapper/lib/wrapper-windows-x86-32.dll - cp wrapper-windows-*/lib/wrapper.jar wrapper/lib/wrapper.jar - rm -rf wrapper-windows-*/ -} +copy_wrapper () { + cp yajsw/$1/setenv* out/bin + cp yajsw/$1/wrapper* out/bin + cp yajsw/$1/install* out/bin + cp yajsw/$1/start* out/bin + cp yajsw/$1/stop* out/bin + cp yajsw/$1/uninstall* out/bin -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 -} + chmod +x out/bin/* -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 -} + cp yajsw/conf/wrapper.conf.default out/conf -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 -} + touch out/conf/wrapper.conf + echo "wrapper.java.app.jar=tracker-server.jar" >> out/conf/wrapper.conf + echo "wrapper.app.parameter.1=./conf/traccar.xml" >> out/conf/wrapper.conf + echo "wrapper.java.additional.1=-Dfile.encoding=UTF-8" >> out/conf/wrapper.conf + echo "wrapper.logfile=logs/wrapper.log.YYYYMMDD" >> out/conf/wrapper.conf + echo "wrapper.logfile.rollmode=DATE" >> out/conf/wrapper.conf + echo "wrapper.ntservice.name=traccar" >> out/conf/wrapper.conf + echo "wrapper.ntservice.displayname=traccar" >> out/conf/wrapper.conf + echo "wrapper.ntservice.description=traccar" >> out/conf/wrapper.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 -} + cp -r yajsw/lib/core out/lib + rm out/lib/core/ReadMe.txt -package_windows () { + cp -r yajsw/lib/extended out/lib + rm out/lib/extended/ReadMe.txt - if [ "$#" -gt 1 ] - then - eval $2 - fi - - wine app/ISCC.exe windows/traccar.iss - - zip -j traccar-$1-$VERSION.zip windows/Output/traccar-setup.exe README.txt + cp yajsw/templates/* out/templates - rm -rf windows/Output/ - rm -rf tmp/ + cp yajsw/wrapper*.jar out } -package_unix () { - - mkdir -p out/{bin,conf,data,lib,logs,web,schema} - - 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 - - sed -i.bak 's/tail -1/tail -n 1/g' out/bin/traccar - chmod +x out/bin/traccar - +copy_files () { cp ../target/tracker-server.jar out cp ../target/lib/* out/lib cp ../schema/* out/schema cp -r ../web/* out/web cp unix/traccar.xml out/conf +} + +package_windows () { + mkdir -p out/{bin,conf,data,lib,logs,web,schema,templates} - sed -i.bak 's/@app.name@/traccar/g' out/bin/traccar - sed -i.bak 's/@app.long.name@/traccar/g' out/bin/traccar + copy_wrapper "bat" + copy_files - sed -i.bak '/wrapper.java.classpath.1/a\ -wrapper.java.classpath.2=../tracker-server.jar' out/conf/wrapper.conf - sed -i.bak '/wrapper.app.parameter.1/a\ -wrapper.app.parameter.2=../conf/traccar.xml' out/conf/wrapper.conf - sed -i.bak 's/wrapper.java.additional.1=/wrapper.java.additional.1=-Dfile.encoding=UTF-8/g' out/conf/wrapper.conf - sed -i.bak 's/<YourMainClass>/org.traccar.Main/g' out/conf/wrapper.conf - sed -i.bak 's/@app.name@/traccar/g' out/conf/wrapper.conf - sed -i.bak 's/@app.long.name@/traccar/g' out/conf/wrapper.conf - sed -i.bak 's/@app.description@/traccar/g' out/conf/wrapper.conf - sed -i.bak 's/wrapper.logfile=..\/logs\/wrapper.log/wrapper.logfile=..\/logs\/wrapper.log.YYYYMMDD\ -wrapper.logfile.rollmode=DATE/g' out/conf/wrapper.conf + wine app/ISCC.exe windows/traccar.iss - rm out/bin/traccar.bak - rm out/conf/wrapper.conf.bak + zip -j traccar-windows-$VERSION.zip windows/Output/traccar-setup.exe README.txt - eval $2 + rm -r windows/Output + rm -r tmp + rm -r out +} - makeself out traccar.run "traccar" "chmod +x setup.sh ; ./setup.sh" - zip -j traccar-$1-$VERSION.zip traccar.run README.txt +package_unix () { + mkdir -p out/{bin,conf,data,lib,logs,web,schema,templates} + + copy_wrapper "bin" + copy_files + + makeself out traccar.run "traccar" "\ +if which java &>/dev/null ; \ +then \ +if [ $(java -version 2>&1 | grep -i version | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -lt 17 ] ; \ +then \ +echo "Java 7 or higher required" ; \ +else \ +mkdir -p /opt/traccar ; \ +cp -r * /opt/traccar ; \ +chmod -R go+rX /opt/traccar ; \ +/opt/traccar/bin/installDaemon.sh ; \ +fi ; \ +else \ +echo "Java runtime is required" ; \ +fi" + + zip -j traccar-linux-$VERSION.zip traccar.run README.txt + cp traccar-linux-$VERSION.zip traccar-macos-$VERSION.zip rm traccar.run - rm -rf out/ + rm -r out } package_universal () { - mkdir -p out/{conf,data,lib,logs,web,schema} - cp ../target/tracker-server.jar out - cp ../target/lib/* out/lib - cp ../schema/* out/schema - cp -r ../web/* out/web - cp windows/traccar.xml out/conf + copy_files + cp README.txt out cd out - zip -r ../traccar-$1-$VERSION.zip * README.txt + zip -r ../traccar-other-$VERSION.zip * cd .. rm -rf out/ @@ -164,12 +149,8 @@ package_universal () { prepare -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" +package_windows +package_unix +package_universal cleanup |