44# sorts out Lintian errors/warnings into individual
55# text files
66pkg=connectd
7- ver=2.1.1
7+ ver=2.1.4
8+ MODIFIED=" February 08, 2019"
89pkgFolder=" $pkg "
910# set architecture
1011controlFilePath=" $pkgFolder " /DEBIAN
@@ -102,12 +103,30 @@ sudo chown -R "$user":"$user" "$pkgFolder"
102103cwd=" $( pwd) /build"
103104mkdir -p $cwd
104105
106+ # build() takes 4 parameters: PLATFORM, arch, buildDeb, and tag (optional)
107+ # PLATFORM indicates the remote.it daemon architecture, e.g. arm-linaro-pi
108+ # buildDeb=0 means make a tar file. buildDeb=1 means make a Debian file
109+ # arch is the Debian architecture, e.g. armhf or amd64
110+ # not required to pass in "arch" if buildDeb=0
111+ # tag is an optional string to put in the file name to distinguish Debian packages
112+ # which have the same "arch" but different "PLATFORM"
113+
105114build () {
106115 echo
107116 echo " ========================================"
108117
109118 echo
110-
119+ PLATFORM=$1
120+ buildDeb=$2
121+ if [ $buildDeb -eq 1 ]; then
122+ arch=$3
123+ else
124+ # give it a default arch, it doesn't matter as we are just building a deb from which to extract the tar file
125+ arch=" amd64"
126+ fi
127+ if [ " $4 " != " " ]; then
128+ tag=" $4 "
129+ fi
111130 setEnvironment " $arch " " $PLATFORM "
112131 # put build date into connected_options
113132 setOption options " BUILDDATE" " \" $( date) \" "
@@ -125,6 +144,12 @@ build() {
125144
126145 echo " Building Debian package for architecture: $arch "
127146 echo " PLATFORM=$PLATFORM "
147+ # tag variable was added to allow building different Debian packages with the same architecture
148+ # e.g. for Vyos I had to make a package using an older daemon architecture but it's still considered
149+ # amd64 or i386 architecture from the dpkg program's point of view
150+ if [ " $tag " != " " ]; then
151+ echo " tag = $tag "
152+ fi
128153
129154 # --------------------------------------------------------
130155 # for Deb pkg build, remove builddate.txt file
@@ -143,7 +168,7 @@ build() {
143168 fi
144169
145170 version=$( grep -i version " $controlFile " | awk ' { print $2 }' )
146- filename=" ${pkg} _${version} _$arch " .deb
171+ filename=" ${pkg} _${version} _$arch$tag " .deb
147172 mv " $pkgFolder " .deb " $cwd /$filename "
148173 else
149174 echo " Building tar package for PLATFORM: $PLATFORM "
@@ -158,79 +183,67 @@ build() {
158183 version=$( grep -i version " $controlFile " | awk ' { print $2 }' )
159184 echo " Extracting contents to tar file"
160185 ./scripts/extract-scripts.sh " $pkgFolder " .deb
161- filename=" ${pkg} _${version} _$PLATFORM " .tar
186+ filename=" ${pkg} _${version} _$PLATFORM$tag " .tar
162187 mv " $pkgFolder " .deb.tar " $cwd /$filename "
163188
164189 fi
190+ ls -l " $cwd /$filename "
165191
166192}
167193
168- buildDeb=0
169- arch=" armhf"
170- PLATFORM=arm-android
171194setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
172195setOption options " PSFLAGS" " ax"
173- build
196+ build arm-android 0
174197
175- buildDeb=0
176- arch=" armhf"
177- PLATFORM=arm-android_static
178198setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
179199setOption options " PSFLAGS" " ax"
180- build
200+ build arm-android_static 0
181201
182- buildDeb=1
183202setOption options " PSFLAGS" " ax"
184203setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
185- arch=" armhf"
186- PLATFORM=arm-linaro-pi
187204setOption options " BASEDIR" " "
188- build
205+ build arm-linaro-pi 1 armhf
189206
190- buildDeb=1
191207setOption options " PSFLAGS" " ax"
192208setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
193- arch=" armel"
194- PLATFORM=arm-linaro-pi
195209setOption options " BASEDIR" " "
196- build
210+ build arm-linaro-pi 1 armel
197211
198- buildDeb=0
199212setOption options " PSFLAGS" " ax"
200213setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
201- arch=" i386"
202- PLATFORM=x86-etch
203214setOption options " BASEDIR" " "
204- build
215+ build x86-etch 0
205216
206- buildDeb=1
207- arch=" amd64"
208217setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
209- PLATFORM=x86_64-ubuntu16.04
210218setOption options " BASEDIR" " "
211219setOption options " PSFLAGS" " ax"
212- build
220+ build x86_64-ubuntu16.04 1 amd64
213221
214- buildDeb=0
215- arch=" armhf"
216- PLATFORM=arm-linaro-pi
217222setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
218223setOption options " PSFLAGS" " ax"
219- build
224+ build arm-linaro-pi 0
220225
221- buildDeb=0
222- arch=" arm-gnueabi"
223- PLATFORM=arm-gnueabi
224226setOption options " PSFLAGS" " w"
225227setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
226- build
228+ build arm-gnueabi 0
229+
230+ setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
231+ setOption options " BASEDIR" " "
232+ setOption options " PSFLAGS" " ax"
233+ build x86_64-etch 0
234+
235+ # here we are using the tag "-etch" to create an amd64 Debian architecture package for the older
236+ # Debian "Etch" architecture that needs to be distinct from the one for Ubuntu 16.04
237+ setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
238+ setOption options " BASEDIR" " "
239+ setOption options " PSFLAGS" " ax"
240+ build x86_64-etch 1 amd64 -etch
227241
228- buildDeb=0
229- arch=" amd64"
230- PLATFORM=x86_64-etch
242+ # here we are using the tag "-etch" to create an i386 Debian architecture package for the older
243+ # Debian "Etch" architecture that needs to be distinct from the one for Ubuntu 16.04
231244setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
232245setOption options " BASEDIR" " "
233246setOption options " PSFLAGS" " ax"
234- build
247+ build x86-etch 1 i386 -etch
235248
236- ls -l " build/ ${pkg} " * . *
249+ echo " ====== build.sh $ver completed ============== "
0 commit comments