From aea9d302716e4ebff0e9bd825b8c83d527629c8d Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sun, 2 Oct 2016 20:17:28 -0500 Subject: [PATCH] chore: only apply upx compression when packaging as appimage Debian packaging tools cannot analyze the binaries if they are compressed with upx. If we move the compression to the appimage command, then the output of the package command can be used for building debian packages. --- scripts/build/linux.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/build/linux.sh b/scripts/build/linux.sh index 0f0c1f76..65651a49 100755 --- a/scripts/build/linux.sh +++ b/scripts/build/linux.sh @@ -32,11 +32,6 @@ if ! command -v bower 2>/dev/null; then exit 1 fi -if ! command -v upx 2>/dev/null; then - echo "Dependency missing: upx" 1>&2 - exit 1 -fi - if ! command -v python 2>/dev/null; then echo "Dependency missing: python" 1>&2 exit 1 @@ -53,6 +48,13 @@ if [ "$COMMAND" != "install" ] && [ "$COMMAND" != "package" ] && [ "$COMMAND" != exit 1 fi +if [ "$COMMAND" == "appimage" ] || [ "$COMMAND" == "all" ]; then + if ! command -v upx 2>/dev/null; then + echo "Dependency missing: upx" 1>&2 + exit 1 + fi +fi + ARCH=$2 if [ "$ARCH" != "x64" ] && [ "$ARCH" != "x86" ]; then echo "Unknown architecture: $ARCH" 1>&2 @@ -102,11 +104,6 @@ function package_x86 { mv $output_package/Etcher $output_package/etcher chmod a+x $output_package/*.so* - - # UPX fails for some reason with some other so libraries - # other than libnode.so in the x86 build - upx -9 $output_package/etcher $output_package/libnode.so - } function package_x64 { @@ -126,7 +123,6 @@ function package_x64 { mv $output_package/Etcher $output_package/etcher chmod a+x $output_package/*.so* - upx -9 $output_package/etcher $output_package/*.so* } function app_dir_create { @@ -177,5 +173,15 @@ if [ "$COMMAND" == "package" ] || [ "$COMMAND" == "all" ]; then fi if [ "$COMMAND" == "appimage" ] || [ "$COMMAND" == "all" ]; then + if [ "$ARCH" == "x86" ]; then + # UPX fails for some reason with some other so libraries + # other than libnode.so in the x86 build + upx -9 $output_package/etcher $output_package/libnode.so + fi + + if [ "$ARCH" == "x64" ]; then + upx -9 $output_package/etcher $output_package/*.so* + fi + installer etcher-release/Etcher-linux-$ARCH $ARCH etcher-release/installers fi