1 #!/bin/sh -- # no runable script, just for vi
5 # we all like colorful messages
6 if [ "$MSGCOLOR" != 'NO' ]; then
7 if [ ! -t 1 ]; then # but check that we output to a terminal
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
() { printf "${CERROR}E: $1${CNORMAL}\n" >&2; exit 1; }
27 msgwarn
() { printf "${CWARNING}W: $1${CNORMAL}\n" >&2; }
28 msgmsg
() { printf "${CMSG}$1${CNORMAL}\n"; }
29 msginfo
() { printf "${CINFO}I: $1${CNORMAL}\n"; }
30 msgdebug
() { printf "${CDEBUG}D: $1${CNORMAL}\n"; }
31 msgdone
() { printf "${CDONE}DONE${CNORMAL}\n"; }
32 msgnwarn
() { printf "${CWARNING}W: $1${CNORMAL}" >&2; }
33 msgnmsg
() { printf "${CMSG}$1${CNORMAL}"; }
34 msgninfo
() { printf "${CINFO}I: $1${CNORMAL}"; }
35 msgndebug
() { printf "${CDEBUG}D: $1${CNORMAL}"; }
38 printf "${CINFO}$1${CCMD} "
39 printf -- "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} "
41 if [ -n "$1" ]; then shift; else break; fi
45 msgpass
() { printf "${CPASS}PASS${CNORMAL}\n"; }
46 msgskip
() { printf "${CWARNING}SKIP${CNORMAL}\n" >&2; }
48 if [ $# -gt 0 ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
49 else printf "${CFAIL}FAIL${CNORMAL}\n" >&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
() { printf " ${CPASS}P${CNORMAL}"; }
67 msgskip
() { printf " ${CWARNING}S${CNORMAL}" >&2; }
68 if [ -n "$CFAIL" ]; then
69 msgfail
() { printf " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
71 msgfail
() { printf " ###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 printf "${CDONE}DONE${CNORMAL}\n";
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 aptsortpkgs
() { runapt apt
-sortpkgs "$@"; }
118 apt
() { runapt apt
"$@"; }
119 apthelper
() { runapt
"${APTHELPERBINDIR}/apt-helper" "$@"; }
120 aptwebserver
() { runapt
"${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
121 aptitude
() { runapt aptitude
"$@"; }
122 aptextracttemplates
() { runapt apt
-extracttemplates "$@"; }
123 aptinternalsolver
() { runapt
"${APTINTERNALSOLVER}" "$@"; }
126 command dpkg
--root=${TMPWORKINGDIRECTORY}/rootdir
--force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir
/var
/log
/dpkg.log
"$@"
128 dpkgcheckbuilddeps
() {
129 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
134 runapt
command gdb
--quiet -ex run
"${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
138 # error if we about to overflow, but ...
139 # "255 failures ought to be enough for everybody"
140 if [ $EXIT_CODE -gt 255 ]; then
141 msgdie
"Total failure count $EXIT_CODE too big"
143 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
146 shellsetedetector
() {
148 if [ "$exit_status" != '0' ]; then
149 printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n"
150 if [ "$EXIT_CODE" = '0' ]; then
151 EXIT_CODE
="$exit_status"
157 if [ "$1" = 'prefix' ]; then
158 CURRENTTRAP
="$2 $CURRENTTRAP"
160 CURRENTTRAP
="$CURRENTTRAP $1"
162 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
166 TMPWORKINGDIRECTORY
=$(mktemp -d)
167 TESTDIRECTORY
=$(readlink -f $(dirname $0))
168 msgninfo
"Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
170 # allow overriding the default BUILDDIR location
171 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
172 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
173 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
174 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
175 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
176 APTINTERNALSOLVER
=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
177 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
180 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
181 cd $TMPWORKINGDIRECTORY
182 mkdir rootdir aptarchive keys
184 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
185 mkdir -p var
/cache var
/lib
/apt var
/log tmp
186 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
187 touch var
/lib
/dpkg
/available
189 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
190 if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
191 mkdir -p usr
/lib
/apt
/solvers
192 ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr
/lib
/apt
/solvers
/dump
193 ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr
/lib
/apt
/solvers
/apt
194 echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc
/apt
/apt.conf.d
/externalsolver.conf
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::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
220 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
221 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
222 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
223 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
224 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
225 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
226 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf
# Added to test multiarch before dpkg is ready for it…
228 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
229 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
230 echo 'quiet::NoStatistic "true";' >> aptconfig.conf
231 echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
232 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
233 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
235 # cleanup the environment a bit
236 # prefer our apt binaries over the system apt binaries
237 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
238 export LC_ALL
=C.UTF
-8
239 unset LANGUAGE APT_CONFIG
240 unset GREP_OPTIONS DEB_BUILD_PROFILES
246 if [ "$1" = "native" -o -z "$1" ]; then
247 eval `aptconfig shell ARCH APT::Architecture`
248 if [ -n "$ARCH" ]; then
251 dpkg
--print-architecture
259 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
262 getarchitecturesfromcommalist
() {
263 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
266 configarchitecture
() {
268 echo "APT::Architecture \"$(getarchitecture $1)\";"
269 while [ -n "$1" ]; do
270 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
273 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
278 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
279 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
280 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
281 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
283 echo -n > rootdir/var/lib/dpkg/status
286 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
287 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
288 local ARCHS="$(getarchitectures)"
289 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
290 DPKGARCH="$(dpkg --print-architecture)"
291 for ARCH in ${ARCHS}; do
292 if [ "${ARCH}" != "${DPKGARCH}" ]; then
293 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
294 # old-style used e.g. in Ubuntu-P – and as it seems travis
295 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
296 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
300 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
301 # dpkg doesn't really check the version as long as it is fully installed,
302 # but just to be sure we choose one above the required version
303 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
309 configcompression() {
310 while [ -n "$1" ]; do
312 '.') printf ".
\t.
\tcat
\n";;
313 'gz') printf "gzip\tgz
\tgzip
\n";;
314 'bz2') printf "bzip2\tbz
2\tbzip
2\n";;
315 'lzma') printf "lzma
\tlzma
\txz
--format=lzma
\n";;
316 'xz') printf "xz
\txz
\txz
\n";;
317 *) printf "$1\t$1\t$1\n";;
320 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
323 setupsimplenativepackage() {
327 local RELEASE="${4:-unstable}"
328 local DEPENDENCIES="$5"
329 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
330 If you
find such a package installed on your system
,
331 something went horribly wrong
! They are autogenerated
332 und used only by testcases and surf no other propose…
"}"
334 local SECTION
="${7:-others}"
336 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
339 DISTSECTION
="$(echo "$SECTION" | cut -d'/' -f 1)"
341 local BUILDDIR
=incoming
/${NAME}-${VERSION}
342 mkdir -p ${BUILDDIR}/debian
/source
344 echo "* most suckless software product ever" > FEATURES
345 test -e debian
/copyright
|| echo "Copyleft by Joe Sixpack $(date +%Y)" > debian
/copyright
346 test -e debian
/changelog
|| echo "$NAME ($VERSION) $RELEASE; urgency=low
350 -- Joe Sixpack <joe@example.org> $(date -R)" > debian
/changelog
351 test -e debian
/control
|| echo "Source: $NAME
354 Maintainer: Joe Sixpack <joe@example.org>
355 Build-Depends: debhelper (>= 7)
356 Standards-Version: 3.9.1
358 Package: $NAME" > debian
/control
359 if [ "$ARCH" = 'all' ]; then
360 echo "Architecture: all" >> debian
/control
362 echo "Architecture: any" >> debian
/control
364 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian
/control
365 echo "Description: $DESCRIPTION" >> debian
/control
367 test -e debian
/compat
|| echo "7" > debian
/compat
368 test -e debian
/source
/format
|| echo "3.0 (native)" > debian
/source
/format
369 test -e debian
/rules
|| cp /usr
/share
/doc
/debhelper
/examples
/rules.tiny debian
/rules
373 buildsimplenativepackage
() {
377 local RELEASE
="${4:-unstable}"
378 local DEPENDENCIES
="$5"
379 local DESCRIPTION
="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
380 If you find such a package installed on your system,
381 something went horribly wrong! They are autogenerated
382 und used only by testcases and surf no other propose…"}"
384 local SECTION="${7:-others}"
385 local PRIORITY="${8:-optional}"
387 local COMPRESS_TYPE="${10:-gzip}"
389 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
392 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
394 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
396 msgninfo "Build package
${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}…
"
397 mkdir -p $BUILDDIR/debian/source
398 echo "* most suckless software product ever
" > ${BUILDDIR}/FEATURES
400 echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
402 echo "Copyleft by Joe Sixpack
$(date +%Y)" > ${BUILDDIR}/debian/copyright
403 echo "$NAME ($VERSION) $RELEASE; urgency
=low
407 -- Joe Sixpack
<joe@example.org
> $(date -R)" > ${BUILDDIR}/debian/changelog
411 Maintainer
: Joe Sixpack
<joe@example.org
>
412 Standards
-Version: 3.9.3" > ${BUILDDIR}/debian/control
413 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
414 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
416 Package
: $NAME" >> ${BUILDDIR}/debian/control
418 if [ "$ARCH" = 'all' ]; then
419 echo "Architecture
: all
" >> ${BUILDDIR}/debian/control
421 echo "Architecture
: any
" >> ${BUILDDIR}/debian/control
423 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
424 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
425 echo "Description
: $DESCRIPTION" >> ${BUILDDIR}/debian/control
427 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
428 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
430 echo "pool
/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
431 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
432 # aptkey --keyring ./keys/joesixpack.pub --quiet adv --yes \
433 # --secret-keyring ./keys/joesixpack.sec --default-key 'Joe Sixpack' \
434 # --clearsign -o "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
435 # mv "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
439 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
440 rm -rf ${BUILDDIR}/debian/tmp
441 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
442 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
443 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
444 if [ -n "$FILE_TREE" ]; then
445 cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
448 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
449 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
450 local LOG="${BUILDDIR}/..
/${NAME}_
${VERSION}_
${arch}.dpkg
-deb.log
"
451 # ensure the right permissions as dpkg-deb ensists
452 chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
453 if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
458 echo "pool
/${NAME}_
${VERSION}_
${arch}.deb
" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
461 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
462 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
463 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
472 local ARCH=$(getarchitecture $4)
473 local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
474 local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
475 msgninfo "Build package
${PKGNAME} for ${RELEASE} in ${SECTION}…
"
477 if [ "$ARCH" = "all
" ]; then
478 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
480 if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
484 local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
485 local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
488 echo "pool
/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
491 echo "pool
/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
497 if [ -d incoming ]; then
498 buildaptarchivefromincoming "$@
"
500 buildaptarchivefromfiles "$@
"
504 createaptftparchiveconfig() {
505 local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
506 COMPRESSORS="${COMPRESSORS%* }"
507 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' ' ')"
508 if [ -z "$ARCHS" ]; then
509 # the pool is empty, so we will operate on faked packages - let us use the configured archs
510 ARCHS
="$(getarchitectures)"
513 ArchiveDir "' >> ftparchive.conf
514 echo -n $(readlink -f .) >> ftparchive.conf
516 CacheDir "' >> ftparchive.conf
517 echo -n $(readlink -f ..) >> ftparchive.conf
519 FileListDir "' >> ftparchive.conf
520 echo -n $(readlink -f pool/) >> ftparchive.conf
524 Packages::Compress "'"$COMPRESSORS"'";
525 Sources::Compress "'"$COMPRESSORS"'";
526 Contents::Compress "'"$COMPRESSORS"'";
527 Translation::Compress "'"$COMPRESSORS"'";
528 LongDescription "false";
532 SrcDirectory "pool/";
538 Label "apttestcases";
540 Description "repository with dummy packages";
541 Architectures "' >> ftparchive.conf
542 echo -n "$ARCHS" >> ftparchive.conf
546 };' >> ftparchive.conf
547 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
548 echo -n 'tree "dists/' >> ftparchive.conf
549 echo -n "$DIST" >> ftparchive.conf
551 Architectures "' >> ftparchive.conf
552 echo -n "$ARCHS" >> ftparchive.conf
554 FileList "' >> ftparchive.conf
555 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
557 SourceFileList "' >> ftparchive.conf
558 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
560 Sections "' >> ftparchive.conf
561 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
563 };' >> ftparchive.conf
567 buildaptftparchivedirectorystructure
() {
568 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
569 for DIST
in $DISTS; do
570 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
571 for SECTION
in $SECTIONS; do
572 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
573 for ARCH
in $ARCHS; do
574 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
576 mkdir -p dists
/${DIST}/${SECTION}/source
577 mkdir -p dists
/${DIST}/${SECTION}/i18n
587 local DEPENDENCIES
="$5"
588 local PRIORITY
="${6:-optional}"
589 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
590 If you find such a package installed on your system,
591 something went horribly wrong! They are autogenerated
592 und used only by testcases and surf no other propose…"}"
594 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
595 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
596 ARCHS="$(getarchitectures)"
600 for BUILDARCH in $ARCHS; do
601 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
602 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
603 touch aptarchive/dists/${RELEASE}/main/source/Sources
604 local FILE="${PPATH}/Packages
"
609 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
610 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
611 echo "Version
: $VERSION
612 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
613 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
614 echo "Description
: $DESCRIPTION" >> $FILE
625 local DEPENDENCIES="$5"
627 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
629 local FILE="${SPATH}/Sources
"
633 Maintainer
: Joe Sixpack
<joe@example.org
>
634 Architecture
: $ARCH" >> $FILE
635 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
637 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.dsc
638 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.
tar.gz
642 insertinstalledpackage() {
646 local DEPENDENCIES="$4"
647 local PRIORITY="${5:-optional}"
648 local STATUS="${6:-install ok installed}"
649 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
650 If you
find such a package installed on your system
,
651 something went horribly wrong
! They are autogenerated
652 und used only by testcases and surf no other propose…
"}"
654 local FILE
='rootdir/var/lib/dpkg/status'
655 local INFO
='rootdir/var/lib/dpkg/info'
656 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
662 Maintainer: Joe Sixpack <joe@example.org>
663 Version: $VERSION" >> $FILE
664 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
665 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
666 echo "Description: $DESCRIPTION" >> $FILE
668 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
669 echo -n > ${INFO}/${NAME}:${arch}.list
671 echo -n > ${INFO}/${NAME}.list
677 buildaptarchivefromincoming
() {
678 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
680 [ -e pool
] || ln -s ..
/incoming pool
681 [ -e ftparchive.conf
] || createaptftparchiveconfig
682 [ -e dists
] || buildaptftparchivedirectorystructure
683 msgninfo
"\tGenerate Packages, Sources and Contents files… "
684 aptftparchive
-qq generate ftparchive.conf
690 buildaptarchivefromfiles
() {
691 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
692 find aptarchive
-name 'Packages' -o -name 'Sources' | while read line
; do
693 msgninfo
"\t${line} file… "
694 compressfile
"$line" "$1"
697 generatereleasefiles
"$@"
701 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
702 if [ "$compressor" = '.' ]; then
708 cat "$1" | $command > "${1}.${extension}"
710 touch -d "$2" "${1}.${extension}"
715 # can be overridden by testcases for their pleasure
716 getcodenamefromsuite
() {
718 unstable
) echo 'sid';;
722 getreleaseversionfromsuite
() { true
; }
723 getlabelfromsuite
() { true
; }
725 generatereleasefiles
() {
726 # $1 is the Date header and $2 is the ValidUntil header to be set
727 # both should be given in notation date/touch can understand
728 msgninfo
"\tGenerate Release files… "
729 if [ -e aptarchive
/dists
]; then
730 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
731 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
732 local CODENAME
="$(getcodenamefromsuite $SUITE)"
733 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
734 local LABEL
="$(getlabelfromsuite $SUITE)"
735 if [ -n "$VERSION" ]; then
736 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
738 if [ -n "$LABEL" ]; then
739 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
741 aptftparchive
-qq release
$dir \
742 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
743 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
746 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
747 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
749 NotAutomatic: yes' $dir/Release
751 if [ -n "$1" -a "$1" != "now" ]; then
752 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
756 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
760 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
762 if [ -n "$1" -a "$1" != "now" ]; then
763 for release
in $(find ./aptarchive -name 'Release'); do
764 touch -d "$1" $release
770 setupdistsaptarchive
() {
771 local APTARCHIVE
=$(readlink -f ./aptarchive)
772 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
773 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
774 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
775 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
776 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
777 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
778 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
783 setupflataptarchive
() {
784 local APTARCHIVE
=$(readlink -f ./aptarchive)
785 if [ -f ${APTARCHIVE}/Packages
]; then
786 msgninfo
"\tadd deb sources.list line… "
787 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
790 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
792 if [ -f ${APTARCHIVE}/Sources
]; then
793 msgninfo
"\tadd deb-src sources.list line… "
794 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
797 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
803 if [ -e aptarchive
/dists
]; then
809 if [ "$1" != '--no-update' ]; then
810 msgninfo
"\tSync APT's cache with the archive… "
817 local SIGNER
="${1:-Joe Sixpack}"
818 local KEY
="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')"
819 local GPG
="aptkey --quiet --keyring ${KEY}.pub adv --batch --yes --secret-keyring ${KEY}.sec"
820 msgninfo
"\tSign archive with $SIGNER key $KEY… "
821 local REXKEY
='keys/rexexpired'
822 local SECEXPIREBAK
="${REXKEY}.sec.bak"
823 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
824 if [ "${SIGNER}" = 'Rex Expired' ]; then
825 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
826 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
827 # therefore we 'temporary' make the key not expired and restore a backup after signing
828 cp ${REXKEY}.sec
$SECEXPIREBAK
829 cp ${REXKEY}.pub
$PUBEXPIREBAK
830 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
831 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
832 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
833 cp $SECUNEXPIRED ${REXKEY}.sec
834 cp $PUBUNEXPIRED ${REXKEY}.pub
836 if ! printf "expire\n1w\nsave\n" | $GPG --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg
2>&1; then
840 cp ${REXKEY}.sec
$SECUNEXPIRED
841 cp ${REXKEY}.pub
$PUBUNEXPIRED
844 for RELEASE
in $(find aptarchive/ -name Release); do
845 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
846 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
847 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
848 # we might have set a specific date for the Release file, so copy it
849 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
851 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
852 mv -f $SECEXPIREBAK ${REXKEY}.sec
853 mv -f $PUBEXPIREBAK ${REXKEY}.pub
859 msgtest
"Set webserver config option '${1}' to" "$2"
860 local DOWNLOG
='rootdir/tmp/download-testfile.log'
861 local STATUS
='rootdir/tmp/webserverconfig.status'
862 rm -f "$STATUS" "$DOWNLOG"
863 if downloadfile
"http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
866 cat "$DOWNLOG" "$STATUS"
869 testwebserverlaststatuscode
'200'
872 rewritesourceslist
() {
873 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
874 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
875 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
879 # wait for up to 10s for a pid file to appear to avoid possible race
880 # when a helper is started and dosn't write the PID quick enough
883 for i
in $(seq 10); do
884 if test -s "$PIDFILE"; then
889 msgdie
"waiting for $PIDFILE failed"
893 changetowebserver
() {
894 if [ "$1" != '--no-rewrite' ]; then
895 rewritesourceslist
'http://localhost:8080/'
899 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
901 local LOG
="webserver.log"
902 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
906 waitforpidfile aptwebserver.pid
907 local PID
="$(cat aptwebserver.pid)"
908 if [ -z "$PID" ]; then
909 msgdie
'Could not fork aptwebserver successfully'
914 msgdie
'You have to build aptwerbserver or install a webserver'
918 changetohttpswebserver
() {
919 if ! which stunnel4
>/dev
/null
; then
920 msgdie
'You need to install stunnel4 for https testcases'
922 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
923 changetowebserver
--no-rewrite "$@"
925 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
926 cert = ${TESTDIRECTORY}/apt.pem
932 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
933 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
934 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
935 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
936 if [ -z "$PID" ]; then
937 msgdie
'Could not fork stunnel4 successfully'
939 addtrap
'prefix' "kill ${PID};"
940 rewritesourceslist
'https://localhost:4433/'
944 mkdir -p rootdir
/media
/cdrom
/.disk
945 local CD
="$(readlink -f rootdir/media/cdrom)"
946 echo "acquire::cdrom::mount \"${CD}\";
947 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
948 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
949 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
950 echo -n "$1" > ${CD}/.disk
/info
951 if [ ! -d aptarchive
/dists
]; then
952 msgdie
'Flat file archive cdroms can not be created currently'
955 mv aptarchive
/dists
"$CD"
956 ln -s "$(readlink -f ./incoming)" $CD/pool
957 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
958 # start with an unmounted disk
959 mv "${CD}" "${CD}-unmounted"
960 # we don't want the disk to be modifiable
961 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
962 chmod -R -w rootdir
/media
/cdrom
-unmounted/dists
966 local PROTO
="$(echo "$1" | cut -d':' -f 1 )"
967 apthelper
-o Debug
::Acquire
::${PROTO}=1 \
968 download
-file "$1" "$2" 2>&1 || true
969 # only if the file exists the download was successful
978 local DIFFTEXT
="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
979 if [ -n "$DIFFTEXT" ]; then
991 msgtest
"Test for correctness of file" "$FILE"
993 echo -n "" | checkdiff
$FILE - && msgpass
|| msgfail
995 echo "$*" | checkdiff
$FILE - && msgpass
|| msgfail
1000 msgtest
"Test for no output of" "$*"
1001 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile"
1002 if $
* >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
1011 local MSG
='Test of equality of'
1012 if [ "$1" = '--nomsg' ]; then
1017 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1018 echo "$1" > $COMPAREFILE
1021 if [ -n "$MSG" ]; then
1024 $
* 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1028 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1029 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1030 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1031 echo "$1" > $COMPAREFILE1
1032 echo "$2" > $COMPAREFILE2
1034 msgtest
"Test for equality OR of" "$*"
1035 $
* >$COMPAREAGAINST 2>&1 || true
1036 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1037 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1041 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
1042 checkdiff
$COMPAREFILE1 $COMPAREAGAINST || true
1043 echo -n "${CINFO}Diff against OR 2${CNORMAL}"
1044 checkdiff
$COMPAREFILE2 $COMPAREAGAINST || true
1050 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1053 while [ -n "$1" ]; do
1055 N: Can't select versions from package '$1' as it is purely virtual"
1056 PACKAGE
="${PACKAGE} $1"
1059 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1061 N: No packages found"
1062 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1063 local ARCH
="$(getarchitecture 'native')"
1064 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
1065 aptcache show
-q=0 $PACKAGE 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1069 msgtest
"Test for non-existent packages" "apt-cache show $*"
1070 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1071 if [ -n "$SHOWPKG" ]; then
1080 testdpkginstalled
() {
1081 msgtest
"Test for correctly installed package(s) with" "dpkg -l $*"
1082 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
1083 if [ "$PKGS" != $# ]; then
1085 dpkg
-l "$@" | grep '^[a-z]' >&2
1092 testdpkgnotinstalled
() {
1093 msgtest
"Test for correctly not-installed package(s) with" "dpkg -l $*"
1094 local PKGS
="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
1095 if [ "$PKGS" != 0 ]; then
1097 dpkg
-l "$@" | grep '^[a-z]' >&2
1105 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1106 if [ -n "$1" ]; then
1107 msgtest
'Test for correctly marked as auto-installed' "$*"
1108 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1110 msgtest
'Test for correctly marked as auto-installed' 'no package'
1111 echo -n > $COMPAREFILE
1113 aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1117 if [ "$1" = '--nomsg' ]; then
1120 msgtest
'Test for successful execution of' "$*"
1122 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1123 if $@
>${OUTPUT} 2>&1; then
1133 if [ "$1" = '--nomsg' ]; then
1136 msgtest
'Test for failure in execution of' "$*"
1138 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1139 if $@
>${OUTPUT} 2>&1; then
1148 testwebserverlaststatuscode
() {
1149 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1150 local STATUS
='rootdir/tmp/webserverstatus-statusfile.log'
1151 rm -f "$DOWNLOG" "$STATUS"
1152 msgtest
'Test last status code from the webserver was' "$1"
1153 downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
1154 if [ "$(cat "$STATUS")" = "$1" ]; then
1158 if [ -n "$2" ]; then
1160 echo >&2 '#### Additionally provided output files contain:'
1163 echo >&2 '#### Download log of the status code:'
1165 msgfail
"Status was $(cat "$STATUS")"
1170 echo "STOPPED execution. Press enter to continue"