mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Generate RPM package
An RPM package is now generated as part of the Linux packaging script. The packaging script can be run on any Debian or Redhat based system and will generate both a deb and rpm package. Resolves https://github.com/bisq-network/bisq/issues/401
This commit is contained in:
parent
db439ce4e2
commit
3683204446
146
desktop/package/linux/package.sh
Normal file
146
desktop/package/linux/package.sh
Normal file
@ -0,0 +1,146 @@
|
||||
#!/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
|
||||
version_base=$(echo $version | awk -F'[_-]' '{print $1}')
|
||||
JAVA_HOME=/usr/lib/jvm/jdk-10.0.2
|
||||
base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../..
|
||||
|
||||
cd $base_dir
|
||||
|
||||
set -eu
|
||||
|
||||
echo Installing required packages
|
||||
if [[ -f "/etc/debian_version" ]]; then
|
||||
apt install -y fakeroot rpm
|
||||
elif [[ -f "/etc/redhat-release" ]]; then
|
||||
yum install -y fakeroot rpm-build dpkg perl-Digest-SHA
|
||||
fi
|
||||
|
||||
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
|
||||
if [ -f "$base_dir/desktop/package/linux/bisq-$version.rpm" ]; then
|
||||
rm "$base_dir/desktop/package/linux/bisq-$version.rpm"
|
||||
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
|
||||
|
||||
echo Generating rpm package
|
||||
$JAVA_HOME/bin/javapackager \
|
||||
-deploy \
|
||||
-BappVersion=$version_base \
|
||||
-Bcategory=Network \
|
||||
-Bemail=contact@bisq.network \
|
||||
-BlicenseType=GPLv3 \
|
||||
-Bicon=$base_dir/desktop/package/linux/icon.png \
|
||||
-native rpm \
|
||||
-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_base-1.x86_64.rpm" ]; then
|
||||
echo No rpm file found at $base_dir/desktop/package/linux/bisq-$version_base-1.x86_64.rpm
|
||||
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
|
||||
|
||||
if [ -f "$base_dir/desktop/package/linux/Bisq-$version_base-1.x86_64.rpm" ]; then
|
||||
rm "$base_dir/desktop/package/linux/Bisq-$version_base-1.x86_64.rpm"
|
||||
fi
|
||||
mv $base_dir/desktop/package/linux/bisq-$version_base-1.x86_64.rpm $base_dir/desktop/package/linux/Bisq-$version.rpm
|
||||
|
||||
echo SHA256 of $base_dir/desktop/package/linux/Bisq-$version.rpm:
|
||||
shasum -a256 $base_dir/desktop/package/linux/Bisq-$version.rpm | awk '{print $1}' | tee $base_dir/desktop/package/linux/Bisq-$version.rpm.txt
|
||||
|
||||
echo Done!
|
79
desktop/package/linux/release.sh
Normal file
79
desktop/package/linux/release.sh
Normal file
@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env bash
|
||||
# Requirements:
|
||||
# - GPG signing key has been created
|
||||
# Prior to running this script:
|
||||
# - Update version below
|
||||
|
||||
version=0.9.1-SNAPSHOT
|
||||
base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../..
|
||||
package_dir=$base_dir/desktop/package
|
||||
release_dir=$base_dir/desktop/release/$version
|
||||
|
||||
dmg=Bisq-$version.dmg
|
||||
deb=Bisq-$version.deb
|
||||
rpm=Bisq-$version.rpm
|
||||
exe=Bisq-$version.exe
|
||||
|
||||
read -p "Enter email address used for gpg signing: " gpg_user
|
||||
|
||||
echo Creating release directory
|
||||
if [ -d "$release_dir" ]; then
|
||||
rm -fr "$release_dir"
|
||||
fi
|
||||
mkdir -p "$release_dir"
|
||||
|
||||
echo Copying files to release folder
|
||||
# sig key mkarrer
|
||||
cp "$package_dir/F379A1C6.asc" "$release_dir"
|
||||
# sig key cbeams
|
||||
cp "$package_dir/5BC5ED73.asc" "$release_dir"
|
||||
# sig key Christoph Atteneder
|
||||
cp "$package_dir/29CDFD3B.asc" "$release_dir"
|
||||
# signing key
|
||||
cp "$package_dir/signingkey.asc" "$release_dir"
|
||||
if [ -f "$package_dir/macosx/$dmg" ]; then
|
||||
cp "$package_dir/macosx/$dmg" "$release_dir"
|
||||
cp "$package_dir/macosx/$dmg.txt" "$release_dir"
|
||||
fi
|
||||
if [ -f "$package_dir/linux/$deb" ]; then
|
||||
cp "$package_dir/linux/$deb" "$release_dir"
|
||||
cp "$package_dir/linux/$deb.txt" "$release_dir"
|
||||
fi
|
||||
if [ -f "$package_dir/linux/$rpm" ]; then
|
||||
cp "$package_dir/linux/$rpm" "$release_dir"
|
||||
cp "$package_dir/linux/$rpm.txt" "$release_dir"
|
||||
fi
|
||||
if [ -f "$package_dir/windows/$exe" ]; then
|
||||
cp "$package_dir/windows/$exe" "$release_dir"
|
||||
cp "$package_dir/windows/$exe.txt" "$release_dir"
|
||||
fi
|
||||
|
||||
echo Creating signatures
|
||||
if [ -f "$release_dir/$dmg" ]; then
|
||||
gpg --digest-algo SHA256 --local-user $gpg_user --output "$release_dir/$dmg.asc" --detach-sig --armor "$release_dir/$dmg"
|
||||
fi
|
||||
if [ -f "$release_dir/$deb" ]; then
|
||||
gpg --digest-algo SHA256 --local-user $gpg_user --output "$release_dir/$deb.asc" --detach-sig --armor "$release_dir/$deb"
|
||||
fi
|
||||
if [ -f "$release_dir/$rpm" ]; then
|
||||
gpg --digest-algo SHA256 --local-user $gpg_user --output "$release_dir/$rpm.asc" --detach-sig --armor "$release_dir/$rpm"
|
||||
fi
|
||||
if [ -f "$release_dir/$exe" ]; then
|
||||
gpg --digest-algo SHA256 --local-user $gpg_user --output "$release_dir/$exe.asc" --detach-sig --armor "$release_dir/$exe"
|
||||
fi
|
||||
|
||||
echo Verifying signatures
|
||||
if [ -f "$release_dir/$dmg" ]; then
|
||||
gpg --digest-algo SHA256 --verify "$release_dir/$dmg.asc"
|
||||
fi
|
||||
if [ -f "$release_dir/$deb" ]; then
|
||||
gpg --digest-algo SHA256 --verify "$release_dir/$deb.asc"
|
||||
fi
|
||||
if [ -f "$release_dir/$rpm" ]; then
|
||||
gpg --digest-algo SHA256 --verify "$release_dir/$rpm.asc"
|
||||
fi
|
||||
if [ -f "$release_dir/$exe" ]; then
|
||||
gpg --digest-algo SHA256 --verify "$release_dir/$exe.asc"
|
||||
fi
|
||||
|
||||
echo Done!
|
@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
## From https://github.com/bisq-network/bisq-desktop/issues/401#issuecomment-372091261
|
||||
|
||||
version=0.9.1
|
||||
|
||||
alien -r -g /home/$USER/Desktop/Bisq-64bit-$version.deb
|
||||
find bisq-$version -type f | while read LIB; do LDDOUT=$(ldd $LIB 2>&1); LDDRETVAL=$?;if [ \( -z "${LDDOUT%%*you do not have execution permission for*}" \) -a \( $LDDRETVAL -eq 0 \) ]; then chmod -v +x $LIB;fi;done
|
||||
cat bisq-$version/bisq-$version-2.spec | while read LINE; do if echo "$LINE" | grep -q "_unpackaged_files_terminate_build" ;then break; else echo "$LINE";fi;done > bisq.spec
|
||||
rm bisq-$version/bisq-$version-2.spec
|
||||
echo "AutoReqProv: no" >> bisq.spec
|
||||
find bisq-$version | /usr/lib/rpm/rpmdeps --requires 2>&1| while read LIB; do if [ -z "$(find bisq-$version -name ${LIB%%(*}\*)" ]; then echo "Requires: $LIB"; fi; done | egrep -v '(libavcodec|libavformat|libavutil)' >> bisq.spec
|
||||
cat >> bisq.spec << "EOF"
|
||||
%description
|
||||
Bisq is ....
|
||||
|
||||
%preun
|
||||
if [ "$1" = 0 ]; then
|
||||
xdg-desktop-menu uninstall --novendor /opt/Bisq/Bisq.desktop
|
||||
fi
|
||||
|
||||
%post
|
||||
xdg-desktop-menu install --novendor /opt/Bisq/Bisq.desktop
|
||||
|
||||
%files
|
||||
/opt/Bisq
|
||||
EOF
|
||||
|
||||
pushd bisq-$version
|
||||
rpmbuild --buildroot=$(pwd) -bb --target x86_64 ../bisq.spec
|
||||
popd
|
Loading…
Reference in New Issue
Block a user