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} "
105 sh
|aptitude
|*/*|command) ;;
106 *) CMD
="${BUILDDIRECTORY}/$CMD";;
108 MALLOC_PERTURB_
=21 MALLOC_CHECK_
=2 APT_CONFIG
="$(getaptconfig)" LD_LIBRARY_PATH
=${LIBRARYPATH} $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
"$@"
132 runapt
command gdb
--quiet -ex run
"${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
135 # see apt-key for the whole trickery. Setup is done in setupenvironment
136 command gpg
--ignore-time-conflict --no-options --no-default-keyring \
137 --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \
138 --no-auto-check-trustdb --trust-model always \
143 # error if we about to overflow, but ...
144 # "255 failures ought to be enough for everybody"
145 if [ $EXIT_CODE -gt 255 ]; then
146 msgdie
"Total failure count $EXIT_CODE too big"
148 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
151 shellsetedetector
() {
153 if [ "$exit_status" != '0' ]; then
154 echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
155 if [ "$EXIT_CODE" = '0' ]; then
156 EXIT_CODE
="$exit_status"
162 if [ "$1" = 'prefix' ]; then
163 CURRENTTRAP
="$2 $CURRENTTRAP"
165 CURRENTTRAP
="$CURRENTTRAP $1"
167 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
171 TMPWORKINGDIRECTORY
=$(mktemp -d)
172 TESTDIRECTORY
=$(readlink -f $(dirname $0))
173 msgninfo
"Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
175 # allow overriding the default BUILDDIR location
176 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
177 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
178 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
179 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
180 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
181 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
184 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
185 cd $TMPWORKINGDIRECTORY
186 mkdir rootdir aptarchive keys
188 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
189 mkdir -p var
/cache var
/lib
/apt var
/log tmp
190 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
191 touch var
/lib
/dpkg
/available
193 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
194 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
196 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
197 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
199 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
202 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
203 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
204 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
206 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
207 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
208 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
210 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
211 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
212 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
213 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
214 echo "Debug::NoLocking \"true\";" >> aptconfig.conf
215 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
216 echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf
217 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
218 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
219 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
220 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
221 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
222 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
223 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf
# Added to test multiarch before dpkg is ready for it…
225 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
226 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
227 echo 'quiet::NoStatistic "true";' >> aptconfig.conf
228 echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
229 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
230 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
232 # gpg needs a trustdb to function, but it can't be invalid (not even empty)
233 # see also apt-key where this trickery comes from:
234 local TRUSTDBDIR
="${TMPWORKINGDIRECTORY}/gnupghome"
236 chmod 700 "$TRUSTDBDIR"
237 # We also don't use a secret keyring, of course, but gpg panics and
238 # implodes if there isn't one available - and writeable for imports
239 local SECRETKEYRING
="${TRUSTDBDIR}/secring.gpg"
241 # now create the trustdb with an (empty) dummy keyring
242 # newer gpg versions are fine without it, but play it safe for now
243 gpg
--quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev
/null
2>&1
245 # cleanup the environment a bit
246 # prefer our apt binaries over the system apt binaries
247 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
248 export LC_ALL
=C.UTF
-8
249 unset LANGUAGE APT_CONFIG
250 unset GREP_OPTIONS DEB_BUILD_PROFILES
256 if [ "$1" = "native" -o -z "$1" ]; then
257 eval `aptconfig shell ARCH APT::Architecture`
258 if [ -n "$ARCH" ]; then
261 dpkg
--print-architecture
269 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
272 getarchitecturesfromcommalist
() {
273 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
276 configarchitecture
() {
278 echo "APT::Architecture \"$(getarchitecture $1)\";"
279 while [ -n "$1" ]; do
280 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
283 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
288 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
289 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
290 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
291 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
293 echo -n > rootdir/var/lib/dpkg/status
296 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
297 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
298 local ARCHS="$(getarchitectures)"
299 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
300 DPKGARCH="$(dpkg --print-architecture)"
301 for ARCH in ${ARCHS}; do
302 if [ "${ARCH}" != "${DPKGARCH}" ]; then
303 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
304 # old-style used e.g. in Ubuntu-P – and as it seems travis
305 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
306 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
310 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
311 # dpkg doesn't really check the version as long as it is fully installed,
312 # but just to be sure we choose one above the required version
313 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
319 configcompression() {
320 while [ -n "$1" ]; do
322 '.') echo ".
\t.
\tcat
";;
323 'gz') echo "gzip\tgz
\tgzip
";;
324 'bz2') echo "bzip2\tbz
2\tbzip
2";;
325 'lzma') echo "lzma
\tlzma
\txz
--format=lzma
";;
326 'xz') echo "xz
\txz
\txz
";;
327 *) echo "$1\t$1\t$1";;
330 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
333 setupsimplenativepackage() {
337 local RELEASE="${4:-unstable}"
338 local DEPENDENCIES="$5"
339 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
340 If you
find such a package installed on your system
,
341 something went horribly wrong
! They are autogenerated
342 und used only by testcases and surf no other propose…
"}"
344 local SECTION
="${7:-others}"
346 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
349 DISTSECTION
="$(echo "$SECTION" | cut -d'/' -f 1)"
351 local BUILDDIR
=incoming
/${NAME}-${VERSION}
352 mkdir -p ${BUILDDIR}/debian
/source
354 echo "* most suckless software product ever" > FEATURES
355 test -e debian
/copyright
|| echo "Copyleft by Joe Sixpack $(date +%Y)" > debian
/copyright
356 test -e debian
/changelog
|| echo "$NAME ($VERSION) $RELEASE; urgency=low
360 -- Joe Sixpack <joe@example.org> $(date -R)" > debian
/changelog
361 test -e debian
/control
|| echo "Source: $NAME
364 Maintainer: Joe Sixpack <joe@example.org>
365 Build-Depends: debhelper (>= 7)
366 Standards-Version: 3.9.1
368 Package: $NAME" > debian
/control
369 if [ "$ARCH" = 'all' ]; then
370 echo "Architecture: all" >> debian
/control
372 echo "Architecture: any" >> debian
/control
374 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian
/control
375 echo "Description: $DESCRIPTION" >> debian
/control
377 test -e debian
/compat
|| echo "7" > debian
/compat
378 test -e debian
/source
/format
|| echo "3.0 (native)" > debian
/source
/format
379 test -e debian
/rules
|| cp /usr
/share
/doc
/debhelper
/examples
/rules.tiny debian
/rules
383 buildsimplenativepackage
() {
387 local RELEASE
="${4:-unstable}"
388 local DEPENDENCIES
="$5"
389 local DESCRIPTION
="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
390 If you find such a package installed on your system,
391 something went horribly wrong! They are autogenerated
392 und used only by testcases and surf no other propose…"}"
394 local SECTION="${7:-others}"
395 local PRIORITY="${8:-optional}"
397 local COMPRESS_TYPE="${10:-gzip}"
399 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
402 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
404 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
406 msgninfo "Build package
${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}…
"
407 mkdir -p $BUILDDIR/debian/source
408 echo "* most suckless software product ever
" > ${BUILDDIR}/FEATURES
410 echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
412 echo "Copyleft by Joe Sixpack
$(date +%Y)" > ${BUILDDIR}/debian/copyright
413 echo "$NAME ($VERSION) $RELEASE; urgency
=low
417 -- Joe Sixpack
<joe@example.org
> $(date -R)" > ${BUILDDIR}/debian/changelog
421 Maintainer
: Joe Sixpack
<joe@example.org
>
422 Standards
-Version: 3.9.3" > ${BUILDDIR}/debian/control
423 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
424 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
426 Package
: $NAME" >> ${BUILDDIR}/debian/control
428 if [ "$ARCH" = 'all' ]; then
429 echo "Architecture
: all
" >> ${BUILDDIR}/debian/control
431 echo "Architecture
: any
" >> ${BUILDDIR}/debian/control
433 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
434 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
435 echo "Description
: $DESCRIPTION" >> ${BUILDDIR}/debian/control
437 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
438 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
440 echo "pool
/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
441 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
442 # gpg --yes --secret-keyring ./keys/joesixpack.sec \
443 # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
444 # --clearsign -o "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
445 # mv "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
449 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
450 rm -rf ${BUILDDIR}/debian/tmp
451 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
452 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
453 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
454 if [ -n "$FILE_TREE" ]; then
455 cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
458 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
459 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
460 local LOG="${BUILDDIR}/..
/${NAME}_
${VERSION}_
${arch}.dpkg
-deb.log
"
461 # ensure the right permissions as dpkg-deb ensists
462 chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
463 if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
468 echo "pool
/${NAME}_
${VERSION}_
${arch}.deb
" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
471 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
472 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
473 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
482 local ARCH=$(getarchitecture $4)
483 local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
484 local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
485 msgninfo "Build package
${PKGNAME} for ${RELEASE} in ${SECTION}…
"
487 if [ "$ARCH" = "all
" ]; then
488 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
490 if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
494 local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
495 local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
498 echo "pool
/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
501 echo "pool
/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
507 if [ -d incoming ]; then
508 buildaptarchivefromincoming "$@
"
510 buildaptarchivefromfiles "$@
"
514 createaptftparchiveconfig() {
515 local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
516 COMPRESSORS="${COMPRESSORS%* }"
517 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' ' ')"
518 if [ -z "$ARCHS" ]; then
519 # the pool is empty, so we will operate on faked packages - let us use the configured archs
520 ARCHS
="$(getarchitectures)"
523 ArchiveDir "' >> ftparchive.conf
524 echo -n $(readlink -f .) >> ftparchive.conf
526 CacheDir "' >> ftparchive.conf
527 echo -n $(readlink -f ..) >> ftparchive.conf
529 FileListDir "' >> ftparchive.conf
530 echo -n $(readlink -f pool/) >> ftparchive.conf
534 Packages::Compress "'"$COMPRESSORS"'";
535 Sources::Compress "'"$COMPRESSORS"'";
536 Contents::Compress "'"$COMPRESSORS"'";
537 Translation::Compress "'"$COMPRESSORS"'";
538 LongDescription "false";
542 SrcDirectory "pool/";
548 Label "apttestcases";
550 Description "repository with dummy packages";
551 Architectures "' >> ftparchive.conf
552 echo -n "$ARCHS" >> ftparchive.conf
556 };' >> ftparchive.conf
557 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
558 echo -n 'tree "dists/' >> ftparchive.conf
559 echo -n "$DIST" >> ftparchive.conf
561 Architectures "' >> ftparchive.conf
562 echo -n "$ARCHS" >> ftparchive.conf
564 FileList "' >> ftparchive.conf
565 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
567 SourceFileList "' >> ftparchive.conf
568 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
570 Sections "' >> ftparchive.conf
571 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
573 };' >> ftparchive.conf
577 buildaptftparchivedirectorystructure
() {
578 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
579 for DIST
in $DISTS; do
580 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
581 for SECTION
in $SECTIONS; do
582 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
583 for ARCH
in $ARCHS; do
584 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
586 mkdir -p dists
/${DIST}/${SECTION}/source
587 mkdir -p dists
/${DIST}/${SECTION}/i18n
597 local DEPENDENCIES
="$5"
598 local PRIORITY
="${6:-optional}"
599 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
600 If you find such a package installed on your system,
601 something went horribly wrong! They are autogenerated
602 und used only by testcases and surf no other propose…"}"
604 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
605 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
606 ARCHS="$(getarchitectures)"
610 for BUILDARCH in $ARCHS; do
611 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
612 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
613 touch aptarchive/dists/${RELEASE}/main/source/Sources
614 local FILE="${PPATH}/Packages
"
619 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
620 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
621 echo "Version
: $VERSION
622 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
623 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
624 echo "Description
: $DESCRIPTION" >> $FILE
635 local DEPENDENCIES="$5"
637 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
639 local FILE="${SPATH}/Sources
"
643 Maintainer
: Joe Sixpack
<joe@example.org
>
644 Architecture
: $ARCH" >> $FILE
645 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
647 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.dsc
648 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.
tar.gz
652 insertinstalledpackage() {
656 local DEPENDENCIES="$4"
657 local PRIORITY="${5:-optional}"
658 local STATUS="${6:-install ok installed}"
659 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
660 If you
find such a package installed on your system
,
661 something went horribly wrong
! They are autogenerated
662 und used only by testcases and surf no other propose…
"}"
664 local FILE
='rootdir/var/lib/dpkg/status'
665 local INFO
='rootdir/var/lib/dpkg/info'
666 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
672 Maintainer: Joe Sixpack <joe@example.org>
673 Version: $VERSION" >> $FILE
674 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
675 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
676 echo "Description: $DESCRIPTION" >> $FILE
678 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
679 echo -n > ${INFO}/${NAME}:${arch}.list
681 echo -n > ${INFO}/${NAME}.list
687 buildaptarchivefromincoming
() {
688 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
690 [ -e pool
] || ln -s ..
/incoming pool
691 [ -e ftparchive.conf
] || createaptftparchiveconfig
692 [ -e dists
] || buildaptftparchivedirectorystructure
693 msgninfo
"\tGenerate Packages, Sources and Contents files… "
694 aptftparchive
-qq generate ftparchive.conf
700 buildaptarchivefromfiles
() {
701 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
702 find aptarchive
-name 'Packages' -o -name 'Sources' | while read line
; do
703 msgninfo
"\t${line} file… "
704 compressfile
"$line" "$1"
707 generatereleasefiles
"$@"
711 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
712 if [ "$compressor" = '.' ]; then
718 cat "$1" | $command > "${1}.${extension}"
720 touch -d "$2" "${1}.${extension}"
725 # can be overridden by testcases for their pleasure
726 getcodenamefromsuite
() {
728 unstable
) echo 'sid';;
732 getreleaseversionfromsuite
() { true
; }
733 getlabelfromsuite
() { true
; }
735 generatereleasefiles
() {
736 # $1 is the Date header and $2 is the ValidUntil header to be set
737 # both should be given in notation date/touch can understand
738 msgninfo
"\tGenerate Release files… "
739 if [ -e aptarchive
/dists
]; then
740 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
741 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
742 local CODENAME
="$(getcodenamefromsuite $SUITE)"
743 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
744 local LABEL
="$(getlabelfromsuite $SUITE)"
745 if [ -n "$VERSION" ]; then
746 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
748 if [ -n "$LABEL" ]; then
749 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
751 aptftparchive
-qq release
$dir \
752 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
753 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
756 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
757 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
759 NotAutomatic: yes' $dir/Release
761 if [ -n "$1" -a "$1" != "now" ]; then
762 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
766 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
770 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
772 if [ -n "$1" -a "$1" != "now" ]; then
773 for release
in $(find ./aptarchive -name 'Release'); do
774 touch -d "$1" $release
780 setupdistsaptarchive
() {
781 local APTARCHIVE
=$(readlink -f ./aptarchive)
782 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
783 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
784 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
785 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
786 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
787 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
788 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
793 setupflataptarchive
() {
794 local APTARCHIVE
=$(readlink -f ./aptarchive)
795 if [ -f ${APTARCHIVE}/Packages
]; then
796 msgninfo
"\tadd deb sources.list line… "
797 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
800 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
802 if [ -f ${APTARCHIVE}/Sources
]; then
803 msgninfo
"\tadd deb-src sources.list line… "
804 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
807 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
813 if [ -e aptarchive
/dists
]; then
819 if [ "$1" != '--no-update' ]; then
820 msgninfo
"\tSync APT's cache with the archive… "
827 local SIGNER
="${1:-Joe Sixpack}"
828 local GPG
="gpg --batch --yes"
829 msgninfo
"\tSign archive with $SIGNER key… "
830 local REXKEY
='keys/rexexpired'
831 local SECEXPIREBAK
="${REXKEY}.sec.bak"
832 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
833 if [ "${SIGNER}" = 'Rex Expired' ]; then
834 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
835 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
836 # therefore we 'temporary' make the key not expired and restore a backup after signing
837 cp ${REXKEY}.sec
$SECEXPIREBAK
838 cp ${REXKEY}.pub
$PUBEXPIREBAK
839 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
840 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
841 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
842 cp $SECUNEXPIRED ${REXKEY}.sec
843 cp $PUBUNEXPIRED ${REXKEY}.pub
845 printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub
--secret-keyring ${REXKEY}.sec
--command-fd 0 --edit-key "${SIGNER}" >/dev
/null
2>&1 || true
846 cp ${REXKEY}.sec
$SECUNEXPIRED
847 cp ${REXKEY}.pub
$PUBUNEXPIRED
850 for KEY
in $(find keys/ -name '*.sec'); do
851 GPG
="$GPG --secret-keyring $KEY"
853 for KEY
in $(find keys/ -name '*.pub'); do
854 GPG
="$GPG --keyring $KEY"
856 for RELEASE
in $(find aptarchive/ -name Release); do
857 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
858 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
859 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
860 # we might have set a specific date for the Release file, so copy it
861 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
863 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
864 mv -f $SECEXPIREBAK ${REXKEY}.sec
865 mv -f $PUBEXPIREBAK ${REXKEY}.pub
871 msgtest
"Set webserver config option '${1}' to" "$2"
872 local DOWNLOG
='rootdir/tmp/download-testfile.log'
873 local STATUS
='rootdir/tmp/webserverconfig.status'
874 rm -f "$STATUS" "$DOWNLOG"
875 if downloadfile
"http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
878 cat "$DOWNLOG" "$STATUS"
881 testwebserverlaststatuscode
'200'
884 rewritesourceslist
() {
885 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
886 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
887 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
891 # wait for up to 10s for a pid file to appear to avoid possible race
892 # when a helper is started and dosn't write the PID quick enough
895 for i
in $(seq 10); do
896 if test -s "$PIDFILE"; then
901 msgdie
"waiting for $PIDFILE failed"
905 changetowebserver
() {
906 if [ "$1" != '--no-rewrite' ]; then
907 rewritesourceslist
'http://localhost:8080/'
911 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
913 local LOG
="webserver.log"
914 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
918 waitforpidfile aptwebserver.pid
919 local PID
="$(cat aptwebserver.pid)"
920 if [ -z "$PID" ]; then
921 msgdie
'Could not fork aptwebserver successfully'
926 msgdie
'You have to build aptwerbserver or install a webserver'
930 changetohttpswebserver
() {
931 if ! which stunnel4
>/dev
/null
; then
932 msgdie
'You need to install stunnel4 for https testcases'
934 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
935 changetowebserver
--no-rewrite "$@"
937 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
938 cert = ${TESTDIRECTORY}/apt.pem
944 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
945 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
946 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
947 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
948 if [ -z "$PID" ]; then
949 msgdie
'Could not fork stunnel4 successfully'
951 addtrap
'prefix' "kill ${PID};"
952 rewritesourceslist
'https://localhost:4433/'
956 mkdir -p rootdir
/media
/cdrom
/.disk
957 local CD
="$(readlink -f rootdir/media/cdrom)"
958 echo "acquire::cdrom::mount \"${CD}\";
959 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
960 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
961 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
962 echo -n "$1" > ${CD}/.disk
/info
963 if [ ! -d aptarchive
/dists
]; then
964 msgdie
'Flat file archive cdroms can not be created currently'
967 mv aptarchive
/dists
"$CD"
968 ln -s "$(readlink -f ./incoming)" $CD/pool
969 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
970 # start with an unmounted disk
971 mv "${CD}" "${CD}-unmounted"
972 # we don't want the disk to be modifiable
973 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
974 chmod -R -w rootdir
/media
/cdrom
-unmounted/dists
978 local PROTO
="$(echo "$1" | cut -d':' -f 1 )"
979 apthelper
-o Debug
::Acquire
::${PROTO}=1 \
980 download
-file "$1" "$2" 2>&1 || true
981 # only if the file exists the download was successful
990 local DIFFTEXT
="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
991 if [ -n "$DIFFTEXT" ]; then
1003 msgtest
"Test for correctness of file" "$FILE"
1004 if [ -z "$*" ]; then
1005 echo -n "" | checkdiff
$FILE - && msgpass
|| msgfail
1007 echo "$*" | checkdiff
$FILE - && msgpass
|| msgfail
1012 msgtest
"Test for no output of" "$*"
1013 test -z "$($* 2>&1)" && msgpass
|| msgfail
1017 local MSG
='Test of equality of'
1018 if [ "$1" = '--nomsg' ]; then
1023 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1024 echo "$1" > $COMPAREFILE
1027 if [ -n "$MSG" ]; then
1030 $
* 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1034 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1035 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1036 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1037 echo "$1" > $COMPAREFILE1
1038 echo "$2" > $COMPAREFILE2
1040 msgtest
"Test for equality OR of" "$*"
1041 $
* >$COMPAREAGAINST 2>&1 || true
1042 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1043 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1047 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
1048 checkdiff
$COMPAREFILE1 $COMPAREAGAINST || true
1049 echo -n "${CINFO}Diff against OR 2${CNORMAL}"
1050 checkdiff
$COMPAREFILE2 $COMPAREAGAINST || true
1056 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1059 while [ -n "$1" ]; do
1061 N: Can't select versions from package '$1' as it is purely virtual"
1062 PACKAGE
="${PACKAGE} $1"
1065 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1067 N: No packages found"
1068 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1069 local ARCH
="$(getarchitecture 'native')"
1070 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
1071 aptcache show
-q=0 $PACKAGE 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1075 msgtest
"Test for non-existent packages" "apt-cache show $*"
1076 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1077 if [ -n "$SHOWPKG" ]; then
1086 testdpkginstalled
() {
1087 msgtest
"Test for correctly installed package(s) with" "dpkg -l $*"
1088 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
1089 if [ "$PKGS" != $# ]; then
1091 dpkg
-l "$@" | grep '^[a-z]' >&2
1098 testdpkgnotinstalled
() {
1099 msgtest
"Test for correctly not-installed package(s) with" "dpkg -l $*"
1100 local PKGS
="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
1101 if [ "$PKGS" != 0 ]; then
1103 dpkg
-l "$@" | grep '^[a-z]' >&2
1111 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1112 if [ -n "$1" ]; then
1113 msgtest
'Test for correctly marked as auto-installed' "$*"
1114 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1116 msgtest
'Test for correctly marked as auto-installed' 'no package'
1117 echo -n > $COMPAREFILE
1119 aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1123 if [ "$1" = '--nomsg' ]; then
1126 msgtest
'Test for successful execution of' "$*"
1128 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1129 if $@
>${OUTPUT} 2>&1; then
1139 if [ "$1" = '--nomsg' ]; then
1142 msgtest
'Test for failure in execution of' "$*"
1144 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1145 if $@
>${OUTPUT} 2>&1; then
1154 testwebserverlaststatuscode
() {
1155 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1156 local STATUS
='rootdir/tmp/webserverstatus-statusfile.log'
1157 rm -f "$DOWNLOG" "$STATUS"
1158 msgtest
'Test last status code from the webserver was' "$1"
1159 downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
1160 if [ "$(cat "$STATUS")" = "$1" ]; then
1164 if [ -n "$2" ]; then
1166 echo >&2 '#### Additionally provided output files contain:'
1169 echo >&2 '#### Download log of the status code:'
1171 msgfail
"Status was $(cat "$STATUS")"
1176 echo "STOPPED execution. Press enter to continue"