bisq/desktop/package/linux/package.sh
Christoph Atteneder 12db932d6e
Not override JAVA_HOME
Developer should configure this properly on its local machine before running the script
2019-01-07 10:55:45 +01:00

106 lines
3.6 KiB
Bash

#!/usr/bin/env bash
# Requirements:
# - OracleJDK 10 installed
# Note: OpenJDK 10 does not have the javapackager util, so must use OracleJDK
# Prior to running this script:
# - Update version below
# - Ensure JAVA_HOME below is pointing to OracleJDK 10 directory
version=0.9.1-SNAPSHOT
base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../..
cd $base_dir
set -e
echo Installing required packages
apt install -y fakeroot
if [ ! -f "$base_dir/desktop/package/desktop-$version-all.jar" ]; then
echo Building application
./gradlew :desktop:clean :desktop:build -x test shadowJar
jar_file=$base_dir/desktop/build/libs/desktop-$version-all.jar
if [ ! -f "$jar_file" ]; then
echo No jar file available at $jar_file
exit 1
fi
tmp=$base_dir/desktop/build/libs/tmp
echo Extracting jar file to $tmp
if [ -d "$tmp" ]; then
rm -rf $tmp
fi
mkdir -p $tmp
unzip -o -q $jar_file -d $tmp
echo Deleting problematic module config from extracted jar
# Strip out Java 9 module configuration used in the fontawesomefx library as it causes javapackager to stop
# because of this existing module information, since it is not used as a module.
# Sometimes module-info.class does not exist - TODO check why and if still needed
if [ -f "$tmp/module-info.class" ]; then
rm -f $tmp/module-info.class
fi
jar_file=$base_dir/desktop/package/desktop-$version-all.jar
echo Zipping jar again without module config to $jar_file
cd $tmp; zip -r -q -X $jar_file *
cd $base_dir; rm -rf $tmp
echo SHA256 before stripping jar file:
shasum -a256 $jar_file | awk '{print $1}'
echo Making deterministic jar by stripping out parameters and comments that contain dates
# Jar file created from https://github.com/ManfredKarrer/tools
# TODO Is this step still necessary? Since we are using preserveFileTimestamps and reproducibleFileOrder in build.gradle
java -jar $base_dir/desktop/package/tools-1.0.jar $jar_file
echo SHA256 after stripping jar file:
shasum -a256 $jar_file | awk '{print $1}' | tee $base_dir/desktop/package/desktop-$version-all.jar.txt
chmod o+rx "$base_dir/desktop/package/desktop-$version-all.jar"
fi
if [ -f "$base_dir/desktop/package/linux/bisq-$version.deb" ]; then
rm "$base_dir/desktop/package/linux/bisq-$version.deb"
fi
# TODO: add the license as soon as it is working with our build setup
#-BlicenseFile=LICENSE \
#-srcfiles package/linux/LICENSE \
echo Generating deb package
$JAVA_HOME/bin/javapackager \
-deploy \
-BappVersion=$version \
-Bcategory=Network \
-Bemail=contact@bisq.network \
-BlicenseType=GPLv3 \
-Bicon=$base_dir/desktop/package/linux/icon.png \
-native deb \
-name Bisq \
-title "The decentralized exchange network." \
-vendor Bisq \
-outdir $base_dir/desktop/package/linux \
-srcdir $base_dir/desktop/package \
-srcfiles desktop-$version-all.jar \
-appclass bisq.desktop.app.BisqAppMain \
-BjvmOptions=-Xss1280k \
-outfile Bisq-$version \
-v
if [ ! -f "$base_dir/desktop/package/linux/bisq-$version.deb" ]; then
echo No deb file found at $base_dir/desktop/package/linux/bisq-$version.deb
exit 2
fi
if [ -f "$base_dir/desktop/package/linux/Bisq-$version.deb" ]; then
rm "$base_dir/desktop/package/linux/Bisq-$version.deb"
fi
mv $base_dir/desktop/package/linux/bisq-$version.deb $base_dir/desktop/package/linux/Bisq-$version.deb
echo SHA256 of $base_dir/desktop/package/linux/Bisq-$version.deb:
shasum -a256 $base_dir/desktop/package/linux/Bisq-$version.deb | awk '{print $1}' | tee $base_dir/desktop/package/linux/Bisq-$version.deb.txt
echo Done!