From 88724376da81f2f6a358b10e7107d2813219153a Mon Sep 17 00:00:00 2001 From: Gambhiro Date: Wed, 9 Dec 2015 21:40:59 +0000 Subject: [PATCH] options for linux packaging helper --- package-linux.sh | 63 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/package-linux.sh b/package-linux.sh index 0c7cd5c..75aebb2 100755 --- a/package-linux.sh +++ b/package-linux.sh @@ -1,5 +1,22 @@ #!/bin/bash +USAGE="`basename $0` +Run this script from the project root. + +Without options, the default is to build a signed source package for uploading +to a Launchpad PPA. + +Options: + +-h --help + +-b --binary +-nb --nobinary +-s --source +-ns --nosource +--signed +--unsigned" + # version for the debian package VERSION=0.9.9.2b PROJECT=fractorium @@ -12,6 +29,25 @@ if [ ! -d '.git' -o ! -f 'main.pro' ]; then exit 2 fi +# Set defaults. +OPT_BUILD_BINARY=0 +OPT_BUILD_SOURCE=1 +OPT_SIGNED=1 + +while [ $# -gt 0 ]; do + case "$1" in + -b|--binary) OPT_BUILD_BINARY=1;; + -nb|--nobinary) OPT_BUILD_BINARY=0;; + -s|--source) OPT_BUILD_SOURCE=1;; + -ns|--nosource) OPT_BUILD_SOURCE=0;; + --signed) OPT_SIGNED=1;; + --unsigned) OPT_SIGNED=0;; + -h|--help) echo "$USAGE" + exit 0;; + esac + shift +done + tarversion=$(tar --version | head -1 | sed -e 's/tar (GNU tar) \+\([0-9\.]\+\)$/\1/; s/[^0-9]//g; s/^\(.{3}\).*$/\1/;') if [[ "$tarversion" -lt "128" ]]; then @@ -56,16 +92,31 @@ bzr add . &&\ [ $? -ne 0 ] && echo "bzr command failed." && exit 2 -# Build a signed source package for Launchpad, it will build its own binary on +# Build a source package. + +# Launchpad only needs a signed source package. It will build its own binary on # the servers. -bzr builddeb -- -S +if [ $OPT_BUILD_SOURCE -eq 1 ]; then + if [ $OPT_SIGNED -eq 1 ]; then + bzr builddeb -- -S + else + bzr builddeb -- -S -us -uc + fi +fi [ $? -ne 0 ] && echo "bzr builddeb for source package failed." && exit 2 -# Optionally, build an unsigned binary package for local use. +# Build an binary package. + +if [ $OPT_BUILD_BINARY -eq 1 ]; then + if [ $OPT_SIGNED -eq 1 ]; then + bzr builddeb -- -b + else + bzr builddeb -- -b -us -uc + fi +fi + +[ $? -ne 0 ] && echo "bzr builddeb for source package failed." && exit 2 -# bzr builddeb -- -b -us -uc -# -# [ $? -ne 0 ] && echo "bzr builddeb for source package failed." && exit 2