Various fixes around Companion trainer mode (#7116)
[opentx.git] / launchpad / prepare.sh
blob19eb551400b0c380b3163fabe6aefa0f4b743a8e
1 #!/bin/sh
2 set -e
3 set -x
5 # $1 is distribution "trusty" OR "yakkety"
7 # Option "-n" or "--nightly" can be used to configure build script to produce a Companion with DALLOW_NIGHTLY_BUILDS=YES flag
10 cd `dirname ${0}`
12 nightly_build=0
14 while [ $# -gt 0 ]
16 case "$1" in
17 --nightly*)
18 nightly_build=1;;
19 -n*)
20 nightly_build=1;;
21 -*)
22 echo >&2 "usage: $0 [-n|--nightly] DISTRO"
23 exit 1;;
25 break;; # terminate while loop
26 esac
27 shift
28 done
31 distro=${1%/}
33 . common/suffix
35 if [ -z ${distro} ] ; then
36 echo "Missing distribution name"
37 exit 1
40 if [ ! -d ${distro} ] ; then
41 echo "Files for ${distro} not found. Most likely unsupported distribution. Aborting..."
42 exit 1
45 echo "Preparing sources for ${distro}..."
47 # prepare debian directory
48 rm -f ../debian/*
49 mkdir -p ../debian/
50 cp common/* ../debian/
51 cp ${distro}/* ../debian/
54 if [ ${nightly_build} -gt 0 ] ; then
55 echo "Editing rules to set version suffix to \"${suffix}\""
56 sed -i "s/__VERSION_SUFFIX__/${suffix}/g" ../debian/rules
57 echo "Setting nightly build flag"
58 sed -i "s/DALLOW_NIGHTLY_BUILDS=YES/DALLOW_NIGHTLY_BUILDS=YES/g" ../debian/rules
59 else
60 sed -i "s/__VERSION_SUFFIX__//g" ../debian/rules
61 sed -i "s/DALLOW_NIGHTLY_BUILDS=YES/DALLOW_NIGHTLY_BUILDS=NO/g" ../debian/rules
64 # remove old package and prepare new one
65 cd ..
66 rm -f ../opentx-companion22_*${distro}*
67 debuild -S -sa -I -Ijenkins -Ilaunchpad -Idoc -Ibuild -I*.luac
69 echo "Use this command to upload to launchpad (nightly builds):"
70 echo " dput ppa:opentx-test/ppa opentx-companion22_<version>.changes"
71 echo "OR releases:"
72 echo " dput ppa:opentx-test/rel opentx-companion22_<version>.changes"