@@ -27,20 +27,25 @@ setEnvironment()
2727 sed -i " /Architecture:/c\Architecture: $1 " " $controlFile "
2828
2929 setOption " options" " Architecture" " $1 "
30- if [ -e " $pkgFolder " /usr/bin/connectd.* ]; then
31- rm " $pkgFolder " /usr/bin/connectd.*
32- fi
33- if [ -e " $pkgFolder " /usr/bin/connectd_schannel.* ]; then
34- rm " $pkgFolder " /usr/bin/connectd_schannel.*
35- fi
30+
31+ for i in $( find " $pkgFolder " /usr/bin/ -type f -name " connectd.*" )
32+ do
33+ rm " $i "
34+ done
35+
36+ for i in $( find " $pkgFolder " /usr/bin/ -type f -name " connectd_schannel.*" )
37+ do
38+ rm " $i "
39+ done
40+
3641 sudo cp ./assets/connectd." $2 " " $pkgFolder " /usr/bin
37- if [ $? = 1 ]; then
42+ if [ $? -eq 1 ]; then
3843 echo " Error, missing file: connectd.$2 "
3944 exit 1
4045 fi
4146 sudo chmod +x " $pkgFolder " /usr/bin/connectd." $2 "
4247 sudo cp ./assets/schannel." $2 " " $pkgFolder " /usr/bin/connectd_schannel." $2 "
43- if [ $? = 1 ]; then
48+ if [ $? -eq 1 ]; then
4449 echo " Error, missing file: schannel.$2 "
4550 exit 1
4651 fi
@@ -57,9 +62,16 @@ setEnvironment()
5762buildDebianFile ()
5863{
5964 # build reference DEB file
65+ ret=0
6066 sudo chown -R root:root " $1 "
61- dpkg-deb --build " $1 "
62- ret=$( runLintian " $1 " .deb)
67+ if [ " $buildDeb " -eq 1 ]; then
68+ dpkg-deb --build " $1 "
69+ # only run lintian if we are really making a Debian package
70+ ret=$( runLintian " $1 " .deb)
71+ else
72+ dpkg-deb --build " $1 "
73+ ret=$?
74+ fi
6375 return $ret
6476}
6577
@@ -68,21 +80,17 @@ runLintian()
6880{
6981 ret_val=0
7082 # scan debian file for errors and warnings
71- lintian -EviIL +pedantic " $1 " > lintian-result.txt
83+ lintian -vi --show-overrides " $1 " > lintian-result.txt
7284 grep E: lintian-result.txt > lintian-E.txt
7385 grep W: lintian-result.txt > lintian-W.txt
7486 grep I: lintian-result.txt > lintian-I.txt
7587 grep X: lintian-result.txt > lintian-X.txt
76- rm lintian-result.txt
7788 if [ -s lintian-E.txt ]; then
7889 ret_val=1
7990 fi
8091 return $ret_val
8192}
8293
83- # copy build tree to /tmp to do actual build
84- # commented out, temporarily disabling this method
85- # cp -R "$pkg" "$pkgFolder"
8694gzip -9 " $pkgFolder " /usr/share/doc/$pkg /* .man
8795
8896# change owner of all files to current user for manipulations
@@ -95,14 +103,9 @@ cwd="$(pwd)/build"
95103mkdir -p $cwd
96104
97105build () {
98- if [ $buildDeb -eq 1 ]; then
99- echo " Building Debian package..."
100- else
101- echo " Building tar package..."
102- fi
106+ echo
107+ echo " ========================================"
103108
104- echo " PLATFORM=$PLATFORM "
105- echo " arch=$arch "
106109 echo
107110
108111 setEnvironment " $arch " " $PLATFORM "
@@ -112,18 +115,16 @@ build() {
112115 # clean up and recreate md5sums file
113116 cd " $pkgFolder "
114117 sudo chmod 777 DEBIAN
115- # ls -l
116118 sudo find -type f ! -regex ' .*?DEBIAN.*' -exec md5sum " {}" + | grep -v md5sums > md5sums
117119 sudo chmod 775 DEBIAN
118120 sudo mv md5sums DEBIAN
119121 sudo chmod 644 DEBIAN/md5sums
120- # cd "$cwd"
121122 cd ..
122- echo " Current directory: $cwd "
123123
124- if [ " $buildDeb " = 1 ]; then
124+ if [ " $buildDeb " -eq 1 ]; then
125125
126126 echo " Building Debian package for architecture: $arch "
127+ echo " PLATFORM=$PLATFORM "
127128
128129 # --------------------------------------------------------
129130 # for Deb pkg build, remove builddate.txt file
@@ -136,41 +137,48 @@ build() {
136137 # --------------------------------------------------------
137138 buildDebianFile " $pkgFolder "
138139
139- if [ $? == 0 ]; then
140- version=$( grep -i version " $controlFile " | awk ' { print $2 }' )
141- filename=" ${pkg} _${version} _$arch " .deb
142- mv " $pkgFolder " .deb " $cwd /$filename "
143- else
140+ if [ $? -eq 1 ]; then
144141 echo " Errors encountered during build."
145- echo " Press Enter to review errors."
146- read anykey
147- less lintian-E.txt
142+ cat lintian-E.txt
148143 fi
149144
145+ version=$( grep -i version " $controlFile " | awk ' { print $2 }' )
146+ filename=" ${pkg} _${version} _$arch " .deb
147+ mv " $pkgFolder " .deb " $cwd /$filename "
150148 else
149+ echo " Building tar package for PLATFORM: $PLATFORM "
151150 # we are making a tar file, but first we make a Debian file
152- # use lintian to check for errors
153151 # then extract the /usr, /etc and /lib folders.
154152 buildDebianFile " $pkgFolder "
155153
156- if [ $? == 0 ]; then
157- version=$( grep -i version " $controlFile " | awk ' { print $2 }' )
158-
159- echo " Extracting contents to tar file"
160- ./scripts/extract-scripts.sh " $pkgFolder " .deb
161- filename=" ${pkg} _${version} _$PLATFORM "
162- mv " $pkgFolder " .deb.tar " $cwd /$filename " .tar
163- else
154+ if [ $? == 1 ]; then
164155 echo " Errors encountered during build."
165- echo " Press Enter to review errors."
166- read anykey
167- less lintian-E.txt
168156 fi
169157
158+ version=$( grep -i version " $controlFile " | awk ' { print $2 }' )
159+ echo " Extracting contents to tar file"
160+ ./scripts/extract-scripts.sh " $pkgFolder " .deb
161+ filename=" ${pkg} _${version} _$PLATFORM " .tar
162+ mv " $pkgFolder " .deb.tar " $cwd /$filename "
163+
170164 fi
171165
172166}
173167
168+ buildDeb=0
169+ arch=" armhf"
170+ PLATFORM=arm-android
171+ setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
172+ setOption options " PSFLAGS" " ax"
173+ build
174+
175+ buildDeb=0
176+ arch=" armhf"
177+ PLATFORM=arm-android_static
178+ setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
179+ setOption options " PSFLAGS" " ax"
180+ build
181+
174182buildDeb=1
175183setOption options " PSFLAGS" " ax"
176184setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
@@ -189,7 +197,6 @@ build
189197
190198buildDeb=0
191199setOption options " PSFLAGS" " ax"
192- # setOption "mac" '$(ip addr | grep ether | tail -n 1 | awk "{ print $2 }")'
193200setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
194201arch=" i386"
195202PLATFORM=x86-etch
@@ -204,20 +211,6 @@ setOption options "BASEDIR" ""
204211setOption options " PSFLAGS" " ax"
205212build
206213
207- buildDeb=0
208- arch=" armhf"
209- PLATFORM=arm-android
210- setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
211- setOption options " PSFLAGS" " ax"
212- build
213-
214- buildDeb=0
215- arch=" armhf"
216- PLATFORM=arm-android_static
217- setOption options " mac" ' $' " (ip addr | grep ether | tail -n 1 | awk" " '{ print" ' $2' " }')"
218- setOption options " PSFLAGS" " ax"
219- build
220-
221214buildDeb=0
222215arch=" armhf"
223216PLATFORM=arm-linaro-pi
@@ -240,4 +233,4 @@ setOption options "BASEDIR" ""
240233setOption options " PSFLAGS" " ax"
241234build
242235
243- ls -l " ${pkg} " * .*
236+ ls -l " build/ ${pkg} " * .*
0 commit comments