1 #!/bin/sh -- # no runable script, just for vi
5 # we all like colorful messages
6 if [ "$MSGCOLOR" != 'NO' ]; then
7 if ! expr match
"$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev
/null
; then
13 if [ "$MSGCOLOR" != 'NO' ]; then
14 CERROR
="\033[1;31m" # red
15 CWARNING
="\033[1;33m" # yellow
16 CMSG
="\033[1;32m" # green
17 CINFO
="\033[1;96m" # light blue
18 CDEBUG
="\033[1;94m" # blue
19 CNORMAL
="\033[0;39m" # default system console color
20 CDONE
="\033[1;32m" # green
21 CPASS
="\033[1;32m" # green
22 CFAIL
="\033[1;31m" # red
23 CCMD
="\033[1;35m" # pink
26 msgdie
() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; }
27 msgwarn
() { echo "${CWARNING}W: $1${CNORMAL}" >&2; }
28 msgmsg
() { echo "${CMSG}$1${CNORMAL}"; }
29 msginfo
() { echo "${CINFO}I: $1${CNORMAL}"; }
30 msgdebug
() { echo "${CDEBUG}D: $1${CNORMAL}"; }
31 msgdone
() { echo "${CDONE}DONE${CNORMAL}"; }
32 msgnwarn
() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; }
33 msgnmsg
() { echo -n "${CMSG}$1${CNORMAL}"; }
34 msgninfo
() { echo -n "${CINFO}I: $1${CNORMAL}"; }
35 msgndebug
() { echo -n "${CDEBUG}D: $1${CNORMAL}"; }
38 echo -n "${CINFO}$1${CCMD} "
39 echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} "
41 if [ -n "$1" ]; then shift; else break; fi
43 echo -n "…${CNORMAL} "
45 msgpass
() { echo "${CPASS}PASS${CNORMAL}"; }
46 msgskip
() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
48 if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2;
49 else echo "${CFAIL}FAIL${CNORMAL}" >&2; fi
50 EXIT_CODE
=$((EXIT_CODE+1));
53 # enable / disable Debugging
54 MSGLEVEL
=${MSGLEVEL:-3}
55 if [ $MSGLEVEL -le 0 ]; then
58 if [ $MSGLEVEL -le 1 ]; then
62 if [ $MSGLEVEL -le 2 ]; then
66 msgpass
() { echo -n " ${CPASS}P${CNORMAL}"; }
67 msgskip
() { echo -n " ${CWARNING}S${CNORMAL}" >&2; }
68 if [ -n "$CFAIL" ]; then
69 msgfail
() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
71 msgfail
() { echo -n " ###FAILED###" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
74 if [ $MSGLEVEL -le 3 ]; then
78 if [ $MSGLEVEL -le 4 ]; then
83 if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
84 [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
85 [ "$1" = "msg" -a $MSGLEVEL -le 2 ] ||
86 [ "$1" = "warn" -a $MSGLEVEL -le 1 ] ||
87 [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
90 echo "${CDONE}DONE${CNORMAL}";
94 if [ -f .
/aptconfig.conf
]; then
95 echo "./aptconfig.conf"
96 elif [ -f ..
/aptconfig.conf
]; then
97 echo "../aptconfig.conf"
101 msgdebug
"Executing: ${CCMD}$*${CDEBUG} "
106 *) CMD
="${BUILDDIRECTORY}/$CMD";;
108 MALLOC_PERTURB_
=21 MALLOC_CHECK_
=2 APT_CONFIG
="$(getaptconfig)" LD_LIBRARY_PATH
=${BUILDDIRECTORY} $CMD "$@"
110 aptconfig
() { runapt apt
-config "$@"; }
111 aptcache
() { runapt apt
-cache "$@"; }
112 aptcdrom
() { runapt apt
-cdrom "$@"; }
113 aptget
() { runapt apt
-get "$@"; }
114 aptftparchive
() { runapt apt
-ftparchive "$@"; }
115 aptkey
() { runapt apt
-key "$@"; }
116 aptmark
() { runapt apt
-mark "$@"; }
117 apt
() { runapt apt
"$@"; }
118 apthelper
() { runapt
"${APTHELPERBINDIR}/apt-helper" "$@"; }
119 aptwebserver
() { runapt
"${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
120 aptitude
() { runapt aptitude
"$@"; }
121 aptextracttemplates
() { runapt apt
-extracttemplates "$@"; }
124 command dpkg
--root=${TMPWORKINGDIRECTORY}/rootdir
--force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir
/var
/log
/dpkg.log
"$@"
126 dpkgcheckbuilddeps
() {
127 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
134 APT_CONFIG
=aptconfig.conf LD_LIBRARY_PATH
=${LIBRARYPATH} command gdb
${BUILDDIRECTORY}/$CMD --args ${BUILDDIRECTORY}/$CMD "$@"
137 # see apt-key for the whole trickery. Setup is done in setupenvironment
138 command gpg
--ignore-time-conflict --no-options --no-default-keyring \
139 --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \
140 --no-auto-check-trustdb --trust-model always \
145 # error if we about to overflow, but ...
146 # "255 failures ought to be enough for everybody"
147 if [ $EXIT_CODE -gt 255 ]; then
148 msgdie
"Total failure count $EXIT_CODE too big"
150 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
153 shellsetedetector
() {
155 if [ "$exit_status" != '0' ]; then
156 echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
157 if [ "$EXIT_CODE" = '0' ]; then
158 EXIT_CODE
="$exit_status"
164 if [ "$1" = 'prefix' ]; then
165 CURRENTTRAP
="$2 $CURRENTTRAP"
167 CURRENTTRAP
="$CURRENTTRAP $1"
169 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
173 TMPWORKINGDIRECTORY
=$(mktemp -d)
174 TESTDIRECTORY
=$(readlink -f $(dirname $0))
175 msgninfo
"Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
177 # allow overriding the default BUILDDIR location
178 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
179 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
180 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
181 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
182 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
183 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
186 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
187 cd $TMPWORKINGDIRECTORY
188 mkdir rootdir aptarchive keys
190 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
191 mkdir -p var
/cache var
/lib
/apt var
/log tmp
192 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
193 touch var
/lib
/dpkg
/available
195 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
196 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
198 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
199 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
201 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
204 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
205 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
206 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
208 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
209 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
210 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
212 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
213 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
214 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
215 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
216 echo "Debug::NoLocking \"true\";" >> aptconfig.conf
217 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
218 echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf
219 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
220 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
221 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
222 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
223 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
224 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
225 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf
# Added to test multiarch before dpkg is ready for it…
227 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
228 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
229 echo 'quiet::NoStatistic "true";' >> aptconfig.conf
230 echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
231 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
232 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
234 # gpg needs a trustdb to function, but it can't be invalid (not even empty)
235 # see also apt-key where this trickery comes from:
236 local TRUSTDBDIR
="${TMPWORKINGDIRECTORY}/gnupghome"
238 chmod 700 "$TRUSTDBDIR"
239 # We also don't use a secret keyring, of course, but gpg panics and
240 # implodes if there isn't one available - and writeable for imports
241 local SECRETKEYRING
="${TRUSTDBDIR}/secring.gpg"
243 # now create the trustdb with an (empty) dummy keyring
244 # newer gpg versions are fine without it, but play it safe for now
245 gpg
--quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev
/null
2>&1
247 # cleanup the environment a bit
248 # prefer our apt binaries over the system apt binaries
249 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
250 export LC_ALL
=C.UTF
-8
251 unset LANGUAGE APT_CONFIG
252 unset GREP_OPTIONS DEB_BUILD_PROFILES
258 if [ "$1" = "native" -o -z "$1" ]; then
259 eval `aptconfig shell ARCH APT::Architecture`
260 if [ -n "$ARCH" ]; then
263 dpkg
--print-architecture
271 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
274 getarchitecturesfromcommalist
() {
275 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
278 configarchitecture
() {
280 echo "APT::Architecture \"$(getarchitecture $1)\";"
281 while [ -n "$1" ]; do
282 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
285 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
290 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
291 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
292 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
293 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
295 echo -n > rootdir/var/lib/dpkg/status
298 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
299 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
300 local ARCHS="$(getarchitectures)"
301 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
302 DPKGARCH="$(dpkg --print-architecture)"
303 for ARCH in ${ARCHS}; do
304 if [ "${ARCH}" != "${DPKGARCH}" ]; then
305 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
306 # old-style used e.g. in Ubuntu-P – and as it seems travis
307 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
308 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
312 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
313 # dpkg doesn't really check the version as long as it is fully installed,
314 # but just to be sure we choose one above the required version
315 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
321 configcompression() {
322 while [ -n "$1" ]; do
324 '.') echo ".
\t.
\tcat
";;
325 'gz') echo "gzip\tgz
\tgzip
";;
326 'bz2') echo "bzip2\tbz
2\tbzip
2";;
327 'lzma') echo "lzma
\tlzma
\txz
--format=lzma
";;
328 'xz') echo "xz
\txz
\txz
";;
329 *) echo "$1\t$1\t$1";;
332 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
335 setupsimplenativepackage() {
339 local RELEASE="${4:-unstable}"
340 local DEPENDENCIES="$5"
341 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
342 If you
find such a package installed on your system
,
343 something went horribly wrong
! They are autogenerated
344 und used only by testcases and surf no other propose…
"}"
346 local SECTION
="${7:-others}"
348 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
351 DISTSECTION
="$(echo "$SECTION" | cut -d'/' -f 1)"
353 local BUILDDIR
=incoming
/${NAME}-${VERSION}
354 mkdir -p ${BUILDDIR}/debian
/source
356 echo "* most suckless software product ever" > FEATURES
357 test -e debian
/copyright
|| echo "Copyleft by Joe Sixpack $(date +%Y)" > debian
/copyright
358 test -e debian
/changelog
|| echo "$NAME ($VERSION) $RELEASE; urgency=low
362 -- Joe Sixpack <joe@example.org> $(date -R)" > debian
/changelog
363 test -e debian
/control
|| echo "Source: $NAME
366 Maintainer: Joe Sixpack <joe@example.org>
367 Build-Depends: debhelper (>= 7)
368 Standards-Version: 3.9.1
370 Package: $NAME" > debian
/control
371 if [ "$ARCH" = 'all' ]; then
372 echo "Architecture: all" >> debian
/control
374 echo "Architecture: any" >> debian
/control
376 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian
/control
377 echo "Description: $DESCRIPTION" >> debian
/control
379 test -e debian
/compat
|| echo "7" > debian
/compat
380 test -e debian
/source
/format
|| echo "3.0 (native)" > debian
/source
/format
381 test -e debian
/rules
|| cp /usr
/share
/doc
/debhelper
/examples
/rules.tiny debian
/rules
385 buildsimplenativepackage
() {
389 local RELEASE
="${4:-unstable}"
390 local DEPENDENCIES
="$5"
391 local DESCRIPTION
="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
392 If you find such a package installed on your system,
393 something went horribly wrong! They are autogenerated
394 und used only by testcases and surf no other propose…"}"
396 local SECTION="${7:-others}"
397 local PRIORITY="${8:-optional}"
399 local COMPRESS_TYPE="${10:-gzip}"
401 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
404 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
406 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
408 msgninfo "Build package
${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}…
"
409 mkdir -p $BUILDDIR/debian/source
410 echo "* most suckless software product ever
" > ${BUILDDIR}/FEATURES
412 echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
414 echo "Copyleft by Joe Sixpack
$(date +%Y)" > ${BUILDDIR}/debian/copyright
415 echo "$NAME ($VERSION) $RELEASE; urgency
=low
419 -- Joe Sixpack
<joe@example.org
> $(date -R)" > ${BUILDDIR}/debian/changelog
423 Maintainer
: Joe Sixpack
<joe@example.org
>
424 Standards
-Version: 3.9.3" > ${BUILDDIR}/debian/control
425 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
426 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
428 Package
: $NAME" >> ${BUILDDIR}/debian/control
430 if [ "$ARCH" = 'all' ]; then
431 echo "Architecture
: all
" >> ${BUILDDIR}/debian/control
433 echo "Architecture
: any
" >> ${BUILDDIR}/debian/control
435 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
436 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
437 echo "Description
: $DESCRIPTION" >> ${BUILDDIR}/debian/control
439 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
440 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
442 echo "pool
/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
443 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
444 # gpg --yes --secret-keyring ./keys/joesixpack.sec \
445 # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
446 # --clearsign -o "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
447 # mv "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
451 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
452 rm -rf ${BUILDDIR}/debian/tmp
453 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
454 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
455 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
456 if [ -n "$FILE_TREE" ]; then
457 cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
460 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
461 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
462 local LOG="${BUILDDIR}/..
/${NAME}_
${VERSION}_
${arch}.dpkg
-deb.log
"
463 # ensure the right permissions as dpkg-deb ensists
464 chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
465 if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
470 echo "pool
/${NAME}_
${VERSION}_
${arch}.deb
" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
473 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
474 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
475 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
484 local ARCH=$(getarchitecture $4)
485 local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
486 local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
487 msgninfo "Build package
${PKGNAME} for ${RELEASE} in ${SECTION}…
"
489 if [ "$ARCH" = "all
" ]; then
490 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
492 if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
496 local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
497 local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
500 echo "pool
/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
503 echo "pool
/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
509 if [ -d incoming ]; then
510 buildaptarchivefromincoming "$@
"
512 buildaptarchivefromfiles "$@
"
516 createaptftparchiveconfig() {
517 local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
518 COMPRESSORS="${COMPRESSORS%* }"
519 local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb
$#\
1#' | tr '\n' ' ')"
520 if [ -z "$ARCHS" ]; then
521 # the pool is empty, so we will operate on faked packages - let us use the configured archs
522 ARCHS
="$(getarchitectures)"
525 ArchiveDir "' >> ftparchive.conf
526 echo -n $(readlink -f .) >> ftparchive.conf
528 CacheDir "' >> ftparchive.conf
529 echo -n $(readlink -f ..) >> ftparchive.conf
531 FileListDir "' >> ftparchive.conf
532 echo -n $(readlink -f pool/) >> ftparchive.conf
536 Packages::Compress "'"$COMPRESSORS"'";
537 Sources::Compress "'"$COMPRESSORS"'";
538 Contents::Compress "'"$COMPRESSORS"'";
539 Translation::Compress "'"$COMPRESSORS"'";
540 LongDescription "false";
544 SrcDirectory "pool/";
550 Label "apttestcases";
552 Description "repository with dummy packages";
553 Architectures "' >> ftparchive.conf
554 echo -n "$ARCHS" >> ftparchive.conf
558 };' >> ftparchive.conf
559 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
560 echo -n 'tree "dists/' >> ftparchive.conf
561 echo -n "$DIST" >> ftparchive.conf
563 Architectures "' >> ftparchive.conf
564 echo -n "$ARCHS" >> ftparchive.conf
566 FileList "' >> ftparchive.conf
567 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
569 SourceFileList "' >> ftparchive.conf
570 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
572 Sections "' >> ftparchive.conf
573 echo -n "$(find ./pool/ -maxdepth 1 -name "${DIST}.*.pkglist" -type f | cut -d'/' -f 3 | cut -d'.' -f 2 | sort | uniq | tr '\n' ' ')" >> ftparchive.conf
575 };' >> ftparchive.conf
579 buildaptftparchivedirectorystructure
() {
580 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
581 for DIST
in $DISTS; do
582 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
583 for SECTION
in $SECTIONS; do
584 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
585 for ARCH
in $ARCHS; do
586 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
588 mkdir -p dists
/${DIST}/${SECTION}/source
589 mkdir -p dists
/${DIST}/${SECTION}/i18n
599 local DEPENDENCIES
="$5"
600 local PRIORITY
="${6:-optional}"
601 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
602 If you find such a package installed on your system,
603 something went horribly wrong! They are autogenerated
604 und used only by testcases and surf no other propose…"}"
606 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
607 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
608 ARCHS="$(getarchitectures)"
612 for BUILDARCH in $ARCHS; do
613 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
614 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
615 touch aptarchive/dists/${RELEASE}/main/source/Sources
616 local FILE="${PPATH}/Packages
"
621 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
622 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
623 echo "Version
: $VERSION
624 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
625 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
626 echo "Description
: $DESCRIPTION" >> $FILE
637 local DEPENDENCIES="$5"
639 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
641 local FILE="${SPATH}/Sources
"
645 Maintainer
: Joe Sixpack
<joe@example.org
>
646 Architecture
: $ARCH" >> $FILE
647 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
649 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.dsc
650 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.
tar.gz
654 insertinstalledpackage() {
658 local DEPENDENCIES="$4"
659 local PRIORITY="${5:-optional}"
660 local STATUS="${6:-install ok installed}"
661 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
662 If you
find such a package installed on your system
,
663 something went horribly wrong
! They are autogenerated
664 und used only by testcases and surf no other propose…
"}"
666 local FILE
='rootdir/var/lib/dpkg/status'
667 local INFO
='rootdir/var/lib/dpkg/info'
668 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
674 Maintainer: Joe Sixpack <joe@example.org>
675 Version: $VERSION" >> $FILE
676 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
677 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
678 echo "Description: $DESCRIPTION" >> $FILE
680 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
681 echo -n > ${INFO}/${NAME}:${arch}.list
683 echo -n > ${INFO}/${NAME}.list
689 buildaptarchivefromincoming
() {
690 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
692 [ -e pool
] || ln -s ..
/incoming pool
693 [ -e ftparchive.conf
] || createaptftparchiveconfig
694 [ -e dists
] || buildaptftparchivedirectorystructure
695 msgninfo
"\tGenerate Packages, Sources and Contents files… "
696 aptftparchive
-qq generate ftparchive.conf
702 buildaptarchivefromfiles
() {
703 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
704 find aptarchive
-name 'Packages' -o -name 'Sources' | while read line
; do
705 msgninfo
"\t${line} file… "
706 compressfile
"$line" "$1"
709 generatereleasefiles
"$@"
713 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
714 if [ "$compressor" = '.' ]; then
720 cat "$1" | $command > "${1}.${extension}"
722 touch -d "$2" "${1}.${extension}"
727 # can be overridden by testcases for their pleasure
728 getcodenamefromsuite
() {
730 unstable
) echo 'sid';;
734 getreleaseversionfromsuite
() { true
; }
735 getlabelfromsuite
() { true
; }
737 generatereleasefiles
() {
738 # $1 is the Date header and $2 is the ValidUntil header to be set
739 # both should be given in notation date/touch can understand
740 msgninfo
"\tGenerate Release files… "
741 if [ -e aptarchive
/dists
]; then
742 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
743 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
744 local CODENAME
="$(getcodenamefromsuite $SUITE)"
745 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
746 local LABEL
="$(getlabelfromsuite $SUITE)"
747 if [ -n "$VERSION" ]; then
748 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
750 if [ -n "$LABEL" ]; then
751 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
753 aptftparchive
-qq release
$dir \
754 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
755 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
758 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
759 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
761 NotAutomatic: yes' $dir/Release
763 if [ -n "$1" -a "$1" != "now" ]; then
764 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
768 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
772 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
774 if [ -n "$1" -a "$1" != "now" ]; then
775 for release
in $(find ./aptarchive -name 'Release'); do
776 touch -d "$1" $release
782 setupdistsaptarchive
() {
783 local APTARCHIVE
=$(readlink -f ./aptarchive)
784 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
785 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
786 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
787 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
788 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
789 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
790 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
795 setupflataptarchive
() {
796 local APTARCHIVE
=$(readlink -f ./aptarchive)
797 if [ -f ${APTARCHIVE}/Packages
]; then
798 msgninfo
"\tadd deb sources.list line… "
799 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
802 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
804 if [ -f ${APTARCHIVE}/Sources
]; then
805 msgninfo
"\tadd deb-src sources.list line… "
806 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
809 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
815 if [ -e aptarchive
/dists
]; then
821 if [ "$1" != '--no-update' ]; then
822 msgninfo
"\tSync APT's cache with the archive… "
829 local SIGNER
="${1:-Joe Sixpack}"
830 local GPG
="gpg --batch --yes"
831 msgninfo
"\tSign archive with $SIGNER key… "
832 local REXKEY
='keys/rexexpired'
833 local SECEXPIREBAK
="${REXKEY}.sec.bak"
834 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
835 if [ "${SIGNER}" = 'Rex Expired' ]; then
836 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
837 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
838 # therefore we 'temporary' make the key not expired and restore a backup after signing
839 cp ${REXKEY}.sec
$SECEXPIREBAK
840 cp ${REXKEY}.pub
$PUBEXPIREBAK
841 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
842 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
843 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
844 cp $SECUNEXPIRED ${REXKEY}.sec
845 cp $PUBUNEXPIRED ${REXKEY}.pub
847 printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub
--secret-keyring ${REXKEY}.sec
--command-fd 0 --edit-key "${SIGNER}" >/dev
/null
2>&1 || true
848 cp ${REXKEY}.sec
$SECUNEXPIRED
849 cp ${REXKEY}.pub
$PUBUNEXPIRED
852 for KEY
in $(find keys/ -name '*.sec'); do
853 GPG
="$GPG --secret-keyring $KEY"
855 for KEY
in $(find keys/ -name '*.pub'); do
856 GPG
="$GPG --keyring $KEY"
858 for RELEASE
in $(find aptarchive/ -name Release); do
859 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
860 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
861 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
862 # we might have set a specific date for the Release file, so copy it
863 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
865 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
866 mv -f $SECEXPIREBAK ${REXKEY}.sec
867 mv -f $PUBEXPIREBAK ${REXKEY}.pub
873 msgtest
"Set webserver config option '${1}' to" "$2"
874 local DOWNLOG
='rootdir/tmp/download-testfile.log'
875 local STATUS
='rootdir/tmp/webserverconfig.status'
876 rm -f "$STATUS" "$DOWNLOG"
877 if downloadfile
"http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
880 cat "$DOWNLOG" "$STATUS"
883 testwebserverlaststatuscode
'200'
886 rewritesourceslist
() {
887 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
888 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
889 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
893 # wait for up to 10s for a pid file to appear to avoid possible race
894 # when a helper is started and dosn't write the PID quick enough
897 for i
in $(seq 10); do
898 if test -s "$PIDFILE"; then
903 msgdie
"waiting for $PIDFILE failed"
907 changetowebserver
() {
908 if [ "$1" != '--no-rewrite' ]; then
909 rewritesourceslist
'http://localhost:8080/'
913 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
915 local LOG
="webserver.log"
916 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
920 waitforpidfile aptwebserver.pid
921 local PID
="$(cat aptwebserver.pid)"
922 if [ -z "$PID" ]; then
923 msgdie
'Could not fork aptwebserver successfully'
928 msgdie
'You have to build aptwerbserver or install a webserver'
932 changetohttpswebserver
() {
933 if ! which stunnel4
>/dev
/null
; then
934 msgdie
'You need to install stunnel4 for https testcases'
936 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
937 changetowebserver
--no-rewrite "$@"
939 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
940 cert = ${TESTDIRECTORY}/apt.pem
946 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
947 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
948 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
949 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
950 if [ -z "$PID" ]; then
951 msgdie
'Could not fork stunnel4 successfully'
953 addtrap
'prefix' "kill ${PID};"
954 rewritesourceslist
'https://localhost:4433/'
958 mkdir -p rootdir
/media
/cdrom
/.disk
959 local CD
="$(readlink -f rootdir/media/cdrom)"
960 echo "acquire::cdrom::mount \"${CD}\";
961 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
962 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
963 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
964 echo -n "$1" > ${CD}/.disk
/info
965 if [ ! -d aptarchive
/dists
]; then
966 msgdie
'Flat file archive cdroms can not be created currently'
969 mv aptarchive
/dists
"$CD"
970 ln -s "$(readlink -f ./incoming)" $CD/pool
971 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
972 # start with an unmounted disk
973 mv "${CD}" "${CD}-unmounted"
974 # we don't want the disk to be modifiable
975 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
976 chmod -R -w rootdir
/media
/cdrom
-unmounted/dists
980 local PROTO
="$(echo "$1" | cut -d':' -f 1 )"
981 apthelper
-o Debug
::Acquire
::${PROTO}=1 \
982 download
-file "$1" "$2" 2>&1 || true
983 # only if the file exists the download was successful
992 local DIFFTEXT
="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
993 if [ -n "$DIFFTEXT" ]; then
1005 msgtest
"Test for correctness of file" "$FILE"
1006 if [ -z "$*" ]; then
1007 echo -n "" | checkdiff
$FILE - && msgpass
|| msgfail
1009 echo "$*" | checkdiff
$FILE - && msgpass
|| msgfail
1014 msgtest
"Test for no output of" "$*"
1015 test -z "$($* 2>&1)" && msgpass
|| msgfail
1019 local MSG
='Test of equality of'
1020 if [ "$1" = '--nomsg' ]; then
1025 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1026 echo "$1" > $COMPAREFILE
1029 if [ -n "$MSG" ]; then
1032 $
* 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1036 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1037 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1038 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1039 echo "$1" > $COMPAREFILE1
1040 echo "$2" > $COMPAREFILE2
1042 msgtest
"Test for equality OR of" "$*"
1043 $
* >$COMPAREAGAINST 2>&1 || true
1044 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1045 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1049 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
1050 checkdiff
$COMPAREFILE1 $COMPAREAGAINST || true
1051 echo -n "${CINFO}Diff against OR 2${CNORMAL}"
1052 checkdiff
$COMPAREFILE2 $COMPAREAGAINST || true
1058 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1061 while [ -n "$1" ]; do
1063 N: Can't select versions from package '$1' as it is purely virtual"
1064 PACKAGE
="${PACKAGE} $1"
1067 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1069 N: No packages found"
1070 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1071 local ARCH
="$(getarchitecture 'native')"
1072 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
1073 aptcache show
-q=0 $PACKAGE 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1077 msgtest
"Test for non-existent packages" "apt-cache show $*"
1078 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1079 if [ -n "$SHOWPKG" ]; then
1088 testdpkginstalled
() {
1089 msgtest
"Test for correctly installed package(s) with" "dpkg -l $*"
1090 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
1091 if [ "$PKGS" != $# ]; then
1093 dpkg
-l "$@" | grep '^[a-z]' >&2
1100 testdpkgnotinstalled
() {
1101 msgtest
"Test for correctly not-installed package(s) with" "dpkg -l $*"
1102 local PKGS
="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
1103 if [ "$PKGS" != 0 ]; then
1105 dpkg
-l "$@" | grep '^[a-z]' >&2
1113 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1114 if [ -n "$1" ]; then
1115 msgtest
'Test for correctly marked as auto-installed' "$*"
1116 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1118 msgtest
'Test for correctly marked as auto-installed' 'no package'
1119 echo -n > $COMPAREFILE
1121 aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1125 if [ "$1" = '--nomsg' ]; then
1128 msgtest
'Test for successful execution of' "$*"
1130 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1131 if $@
>${OUTPUT} 2>&1; then
1141 if [ "$1" = '--nomsg' ]; then
1144 msgtest
'Test for failure in execution of' "$*"
1146 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1147 if $@
>${OUTPUT} 2>&1; then
1156 testwebserverlaststatuscode
() {
1157 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1158 local STATUS
='rootdir/tmp/webserverstatus-statusfile.log'
1159 rm -f "$DOWNLOG" "$STATUS"
1160 msgtest
'Test last status code from the webserver was' "$1"
1161 downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
1162 if [ "$(cat "$STATUS")" = "$1" ]; then
1166 if [ -n "$2" ]; then
1168 echo >&2 '#### Additionally provided output files contain:'
1171 echo >&2 '#### Download log of the status code:'
1173 msgfail
"Status was $(cat "$STATUS")"
1178 echo "STOPPED execution. Press enter to continue"