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#^apt\([cgfs]\)#apt-\1#')${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 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 "$@"; }
125 command dpkg
--root=${TMPWORKINGDIRECTORY}/rootdir
--force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir
/var
/log
/dpkg.log
"$@"
127 dpkgcheckbuilddeps
() {
128 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
133 runapt
command gdb
--quiet -ex run
"${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
136 # see apt-key for the whole trickery. Setup is done in setupenvironment
137 command gpg
--ignore-time-conflict --no-options --no-default-keyring \
138 --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \
139 --no-auto-check-trustdb --trust-model always \
144 # error if we about to overflow, but ...
145 # "255 failures ought to be enough for everybody"
146 if [ $EXIT_CODE -gt 255 ]; then
147 msgdie
"Total failure count $EXIT_CODE too big"
149 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
152 shellsetedetector
() {
154 if [ "$exit_status" != '0' ]; then
155 echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
156 if [ "$EXIT_CODE" = '0' ]; then
157 EXIT_CODE
="$exit_status"
163 if [ "$1" = 'prefix' ]; then
164 CURRENTTRAP
="$2 $CURRENTTRAP"
166 CURRENTTRAP
="$CURRENTTRAP $1"
168 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
172 TMPWORKINGDIRECTORY
=$(mktemp -d)
173 TESTDIRECTORY
=$(readlink -f $(dirname $0))
174 msgninfo
"Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
176 # allow overriding the default BUILDDIR location
177 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
178 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
179 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
180 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
181 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
182 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
185 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
186 cd $TMPWORKINGDIRECTORY
187 mkdir rootdir aptarchive keys
189 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
190 mkdir -p var
/cache var
/lib
/apt var
/log tmp
191 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
192 touch var
/lib
/dpkg
/available
194 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
195 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
197 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
198 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
200 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
203 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
204 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
205 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
207 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
208 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
209 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
211 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
212 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
213 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
214 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
215 echo "Debug::NoLocking \"true\";" >> aptconfig.conf
216 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
217 echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf
218 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
219 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
220 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
221 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
222 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
223 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
224 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf
# Added to test multiarch before dpkg is ready for it…
226 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
227 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
228 echo 'quiet::NoStatistic "true";' >> aptconfig.conf
229 echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
230 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
231 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
233 # gpg needs a trustdb to function, but it can't be invalid (not even empty)
234 # see also apt-key where this trickery comes from:
235 local TRUSTDBDIR
="${TMPWORKINGDIRECTORY}/gnupghome"
237 chmod 700 "$TRUSTDBDIR"
238 # We also don't use a secret keyring, of course, but gpg panics and
239 # implodes if there isn't one available - and writeable for imports
240 local SECRETKEYRING
="${TRUSTDBDIR}/secring.gpg"
242 # now create the trustdb with an (empty) dummy keyring
243 # newer gpg versions are fine without it, but play it safe for now
244 gpg
--quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev
/null
2>&1
246 # cleanup the environment a bit
247 # prefer our apt binaries over the system apt binaries
248 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
249 export LC_ALL
=C.UTF
-8
250 unset LANGUAGE APT_CONFIG
251 unset GREP_OPTIONS DEB_BUILD_PROFILES
257 if [ "$1" = "native" -o -z "$1" ]; then
258 eval `aptconfig shell ARCH APT::Architecture`
259 if [ -n "$ARCH" ]; then
262 dpkg
--print-architecture
270 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
273 getarchitecturesfromcommalist
() {
274 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
277 configarchitecture
() {
279 echo "APT::Architecture \"$(getarchitecture $1)\";"
280 while [ -n "$1" ]; do
281 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
284 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
289 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
290 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
291 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
292 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
294 echo -n > rootdir/var/lib/dpkg/status
297 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
298 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
299 local ARCHS="$(getarchitectures)"
300 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
301 DPKGARCH="$(dpkg --print-architecture)"
302 for ARCH in ${ARCHS}; do
303 if [ "${ARCH}" != "${DPKGARCH}" ]; then
304 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
305 # old-style used e.g. in Ubuntu-P – and as it seems travis
306 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
307 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
311 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
312 # dpkg doesn't really check the version as long as it is fully installed,
313 # but just to be sure we choose one above the required version
314 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
320 configcompression() {
321 while [ -n "$1" ]; do
323 '.') echo ".
\t.
\tcat
";;
324 'gz') echo "gzip\tgz
\tgzip
";;
325 'bz2') echo "bzip2\tbz
2\tbzip
2";;
326 'lzma') echo "lzma
\tlzma
\txz
--format=lzma
";;
327 'xz') echo "xz
\txz
\txz
";;
328 *) echo "$1\t$1\t$1";;
331 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
334 setupsimplenativepackage() {
338 local RELEASE="${4:-unstable}"
339 local DEPENDENCIES="$5"
340 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
341 If you
find such a package installed on your system
,
342 something went horribly wrong
! They are autogenerated
343 und used only by testcases and surf no other propose…
"}"
345 local SECTION
="${7:-others}"
347 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
350 DISTSECTION
="$(echo "$SECTION" | cut -d'/' -f 1)"
352 local BUILDDIR
=incoming
/${NAME}-${VERSION}
353 mkdir -p ${BUILDDIR}/debian
/source
355 echo "* most suckless software product ever" > FEATURES
356 test -e debian
/copyright
|| echo "Copyleft by Joe Sixpack $(date +%Y)" > debian
/copyright
357 test -e debian
/changelog
|| echo "$NAME ($VERSION) $RELEASE; urgency=low
361 -- Joe Sixpack <joe@example.org> $(date -R)" > debian
/changelog
362 test -e debian
/control
|| echo "Source: $NAME
365 Maintainer: Joe Sixpack <joe@example.org>
366 Build-Depends: debhelper (>= 7)
367 Standards-Version: 3.9.1
369 Package: $NAME" > debian
/control
370 if [ "$ARCH" = 'all' ]; then
371 echo "Architecture: all" >> debian
/control
373 echo "Architecture: any" >> debian
/control
375 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian
/control
376 echo "Description: $DESCRIPTION" >> debian
/control
378 test -e debian
/compat
|| echo "7" > debian
/compat
379 test -e debian
/source
/format
|| echo "3.0 (native)" > debian
/source
/format
380 test -e debian
/rules
|| cp /usr
/share
/doc
/debhelper
/examples
/rules.tiny debian
/rules
384 buildsimplenativepackage
() {
388 local RELEASE
="${4:-unstable}"
389 local DEPENDENCIES
="$5"
390 local DESCRIPTION
="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
391 If you find such a package installed on your system,
392 something went horribly wrong! They are autogenerated
393 und used only by testcases and surf no other propose…"}"
395 local SECTION="${7:-others}"
396 local PRIORITY="${8:-optional}"
398 local COMPRESS_TYPE="${10:-gzip}"
400 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
403 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
405 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
407 msgninfo "Build package
${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}…
"
408 mkdir -p $BUILDDIR/debian/source
409 echo "* most suckless software product ever
" > ${BUILDDIR}/FEATURES
411 echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
413 echo "Copyleft by Joe Sixpack
$(date +%Y)" > ${BUILDDIR}/debian/copyright
414 echo "$NAME ($VERSION) $RELEASE; urgency
=low
418 -- Joe Sixpack
<joe@example.org
> $(date -R)" > ${BUILDDIR}/debian/changelog
422 Maintainer
: Joe Sixpack
<joe@example.org
>
423 Standards
-Version: 3.9.3" > ${BUILDDIR}/debian/control
424 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
425 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
427 Package
: $NAME" >> ${BUILDDIR}/debian/control
429 if [ "$ARCH" = 'all' ]; then
430 echo "Architecture
: all
" >> ${BUILDDIR}/debian/control
432 echo "Architecture
: any
" >> ${BUILDDIR}/debian/control
434 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
435 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
436 echo "Description
: $DESCRIPTION" >> ${BUILDDIR}/debian/control
438 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
439 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
441 echo "pool
/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
442 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
443 # gpg --yes --secret-keyring ./keys/joesixpack.sec \
444 # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
445 # --clearsign -o "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
446 # mv "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
450 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
451 rm -rf ${BUILDDIR}/debian/tmp
452 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
453 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
454 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
455 if [ -n "$FILE_TREE" ]; then
456 cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
459 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
460 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
461 local LOG="${BUILDDIR}/..
/${NAME}_
${VERSION}_
${arch}.dpkg
-deb.log
"
462 # ensure the right permissions as dpkg-deb ensists
463 chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
464 if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
469 echo "pool
/${NAME}_
${VERSION}_
${arch}.deb
" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
472 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
473 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
474 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
483 local ARCH=$(getarchitecture $4)
484 local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
485 local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
486 msgninfo "Build package
${PKGNAME} for ${RELEASE} in ${SECTION}…
"
488 if [ "$ARCH" = "all
" ]; then
489 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
491 if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
495 local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
496 local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
499 echo "pool
/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
502 echo "pool
/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
508 if [ -d incoming ]; then
509 buildaptarchivefromincoming "$@
"
511 buildaptarchivefromfiles "$@
"
515 createaptftparchiveconfig() {
516 local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
517 COMPRESSORS="${COMPRESSORS%* }"
518 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' ' ')"
519 if [ -z "$ARCHS" ]; then
520 # the pool is empty, so we will operate on faked packages - let us use the configured archs
521 ARCHS
="$(getarchitectures)"
524 ArchiveDir "' >> ftparchive.conf
525 echo -n $(readlink -f .) >> ftparchive.conf
527 CacheDir "' >> ftparchive.conf
528 echo -n $(readlink -f ..) >> ftparchive.conf
530 FileListDir "' >> ftparchive.conf
531 echo -n $(readlink -f pool/) >> ftparchive.conf
535 Packages::Compress "'"$COMPRESSORS"'";
536 Sources::Compress "'"$COMPRESSORS"'";
537 Contents::Compress "'"$COMPRESSORS"'";
538 Translation::Compress "'"$COMPRESSORS"'";
539 LongDescription "false";
543 SrcDirectory "pool/";
549 Label "apttestcases";
551 Description "repository with dummy packages";
552 Architectures "' >> ftparchive.conf
553 echo -n "$ARCHS" >> ftparchive.conf
557 };' >> ftparchive.conf
558 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
559 echo -n 'tree "dists/' >> ftparchive.conf
560 echo -n "$DIST" >> ftparchive.conf
562 Architectures "' >> ftparchive.conf
563 echo -n "$ARCHS" >> ftparchive.conf
565 FileList "' >> ftparchive.conf
566 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
568 SourceFileList "' >> ftparchive.conf
569 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
571 Sections "' >> ftparchive.conf
572 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
574 };' >> ftparchive.conf
578 buildaptftparchivedirectorystructure
() {
579 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
580 for DIST
in $DISTS; do
581 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
582 for SECTION
in $SECTIONS; do
583 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
584 for ARCH
in $ARCHS; do
585 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
587 mkdir -p dists
/${DIST}/${SECTION}/source
588 mkdir -p dists
/${DIST}/${SECTION}/i18n
598 local DEPENDENCIES
="$5"
599 local PRIORITY
="${6:-optional}"
600 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
601 If you find such a package installed on your system,
602 something went horribly wrong! They are autogenerated
603 und used only by testcases and surf no other propose…"}"
605 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
606 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
607 ARCHS="$(getarchitectures)"
611 for BUILDARCH in $ARCHS; do
612 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
613 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
614 touch aptarchive/dists/${RELEASE}/main/source/Sources
615 local FILE="${PPATH}/Packages
"
620 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
621 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
622 echo "Version
: $VERSION
623 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
624 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
625 echo "Description
: $DESCRIPTION" >> $FILE
636 local DEPENDENCIES="$5"
638 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
640 local FILE="${SPATH}/Sources
"
644 Maintainer
: Joe Sixpack
<joe@example.org
>
645 Architecture
: $ARCH" >> $FILE
646 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
648 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.dsc
649 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.
tar.gz
653 insertinstalledpackage() {
657 local DEPENDENCIES="$4"
658 local PRIORITY="${5:-optional}"
659 local STATUS="${6:-install ok installed}"
660 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
661 If you
find such a package installed on your system
,
662 something went horribly wrong
! They are autogenerated
663 und used only by testcases and surf no other propose…
"}"
665 local FILE
='rootdir/var/lib/dpkg/status'
666 local INFO
='rootdir/var/lib/dpkg/info'
667 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
673 Maintainer: Joe Sixpack <joe@example.org>
674 Version: $VERSION" >> $FILE
675 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
676 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
677 echo "Description: $DESCRIPTION" >> $FILE
679 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
680 echo -n > ${INFO}/${NAME}:${arch}.list
682 echo -n > ${INFO}/${NAME}.list
688 buildaptarchivefromincoming
() {
689 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
691 [ -e pool
] || ln -s ..
/incoming pool
692 [ -e ftparchive.conf
] || createaptftparchiveconfig
693 [ -e dists
] || buildaptftparchivedirectorystructure
694 msgninfo
"\tGenerate Packages, Sources and Contents files… "
695 aptftparchive
-qq generate ftparchive.conf
701 buildaptarchivefromfiles
() {
702 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
703 find aptarchive
-name 'Packages' -o -name 'Sources' | while read line
; do
704 msgninfo
"\t${line} file… "
705 compressfile
"$line" "$1"
708 generatereleasefiles
"$@"
712 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
713 if [ "$compressor" = '.' ]; then
719 cat "$1" | $command > "${1}.${extension}"
721 touch -d "$2" "${1}.${extension}"
726 # can be overridden by testcases for their pleasure
727 getcodenamefromsuite
() {
729 unstable
) echo 'sid';;
733 getreleaseversionfromsuite
() { true
; }
734 getlabelfromsuite
() { true
; }
736 generatereleasefiles
() {
737 # $1 is the Date header and $2 is the ValidUntil header to be set
738 # both should be given in notation date/touch can understand
739 msgninfo
"\tGenerate Release files… "
740 if [ -e aptarchive
/dists
]; then
741 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
742 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
743 local CODENAME
="$(getcodenamefromsuite $SUITE)"
744 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
745 local LABEL
="$(getlabelfromsuite $SUITE)"
746 if [ -n "$VERSION" ]; then
747 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
749 if [ -n "$LABEL" ]; then
750 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
752 aptftparchive
-qq release
$dir \
753 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
754 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
757 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
758 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
760 NotAutomatic: yes' $dir/Release
762 if [ -n "$1" -a "$1" != "now" ]; then
763 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
767 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
771 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
773 if [ -n "$1" -a "$1" != "now" ]; then
774 for release
in $(find ./aptarchive -name 'Release'); do
775 touch -d "$1" $release
781 setupdistsaptarchive
() {
782 local APTARCHIVE
=$(readlink -f ./aptarchive)
783 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
784 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
785 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
786 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
787 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
788 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
789 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
794 setupflataptarchive
() {
795 local APTARCHIVE
=$(readlink -f ./aptarchive)
796 if [ -f ${APTARCHIVE}/Packages
]; then
797 msgninfo
"\tadd deb sources.list line… "
798 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
801 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
803 if [ -f ${APTARCHIVE}/Sources
]; then
804 msgninfo
"\tadd deb-src sources.list line… "
805 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
808 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
814 if [ -e aptarchive
/dists
]; then
820 if [ "$1" != '--no-update' ]; then
821 msgninfo
"\tSync APT's cache with the archive… "
828 local SIGNER
="${1:-Joe Sixpack}"
829 local GPG
="gpg --batch --yes"
830 msgninfo
"\tSign archive with $SIGNER key… "
831 local REXKEY
='keys/rexexpired'
832 local SECEXPIREBAK
="${REXKEY}.sec.bak"
833 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
834 if [ "${SIGNER}" = 'Rex Expired' ]; then
835 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
836 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
837 # therefore we 'temporary' make the key not expired and restore a backup after signing
838 cp ${REXKEY}.sec
$SECEXPIREBAK
839 cp ${REXKEY}.pub
$PUBEXPIREBAK
840 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
841 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
842 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
843 cp $SECUNEXPIRED ${REXKEY}.sec
844 cp $PUBUNEXPIRED ${REXKEY}.pub
846 printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub
--secret-keyring ${REXKEY}.sec
--command-fd 0 --edit-key "${SIGNER}" >/dev
/null
2>&1 || true
847 cp ${REXKEY}.sec
$SECUNEXPIRED
848 cp ${REXKEY}.pub
$PUBUNEXPIRED
851 for KEY
in $(find keys/ -name '*.sec'); do
852 GPG
="$GPG --secret-keyring $KEY"
854 for KEY
in $(find keys/ -name '*.pub'); do
855 GPG
="$GPG --keyring $KEY"
857 for RELEASE
in $(find aptarchive/ -name Release); do
858 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
859 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
860 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
861 # we might have set a specific date for the Release file, so copy it
862 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
864 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
865 mv -f $SECEXPIREBAK ${REXKEY}.sec
866 mv -f $PUBEXPIREBAK ${REXKEY}.pub
872 msgtest
"Set webserver config option '${1}' to" "$2"
873 local DOWNLOG
='rootdir/tmp/download-testfile.log'
874 local STATUS
='rootdir/tmp/webserverconfig.status'
875 rm -f "$STATUS" "$DOWNLOG"
876 if downloadfile
"http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
879 cat "$DOWNLOG" "$STATUS"
882 testwebserverlaststatuscode
'200'
885 rewritesourceslist
() {
886 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
887 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
888 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
892 # wait for up to 10s for a pid file to appear to avoid possible race
893 # when a helper is started and dosn't write the PID quick enough
896 for i
in $(seq 10); do
897 if test -s "$PIDFILE"; then
902 msgdie
"waiting for $PIDFILE failed"
906 changetowebserver
() {
907 if [ "$1" != '--no-rewrite' ]; then
908 rewritesourceslist
'http://localhost:8080/'
912 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
914 local LOG
="webserver.log"
915 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
919 waitforpidfile aptwebserver.pid
920 local PID
="$(cat aptwebserver.pid)"
921 if [ -z "$PID" ]; then
922 msgdie
'Could not fork aptwebserver successfully'
927 msgdie
'You have to build aptwerbserver or install a webserver'
931 changetohttpswebserver
() {
932 if ! which stunnel4
>/dev
/null
; then
933 msgdie
'You need to install stunnel4 for https testcases'
935 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
936 changetowebserver
--no-rewrite "$@"
938 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
939 cert = ${TESTDIRECTORY}/apt.pem
945 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
946 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
947 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
948 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
949 if [ -z "$PID" ]; then
950 msgdie
'Could not fork stunnel4 successfully'
952 addtrap
'prefix' "kill ${PID};"
953 rewritesourceslist
'https://localhost:4433/'
957 mkdir -p rootdir
/media
/cdrom
/.disk
958 local CD
="$(readlink -f rootdir/media/cdrom)"
959 echo "acquire::cdrom::mount \"${CD}\";
960 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
961 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
962 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
963 echo -n "$1" > ${CD}/.disk
/info
964 if [ ! -d aptarchive
/dists
]; then
965 msgdie
'Flat file archive cdroms can not be created currently'
968 mv aptarchive
/dists
"$CD"
969 ln -s "$(readlink -f ./incoming)" $CD/pool
970 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
971 # start with an unmounted disk
972 mv "${CD}" "${CD}-unmounted"
973 # we don't want the disk to be modifiable
974 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
975 chmod -R -w rootdir
/media
/cdrom
-unmounted/dists
979 local PROTO
="$(echo "$1" | cut -d':' -f 1 )"
980 apthelper
-o Debug
::Acquire
::${PROTO}=1 \
981 download
-file "$1" "$2" 2>&1 || true
982 # only if the file exists the download was successful
991 local DIFFTEXT
="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
992 if [ -n "$DIFFTEXT" ]; then
1004 msgtest
"Test for correctness of file" "$FILE"
1005 if [ -z "$*" ]; then
1006 echo -n "" | checkdiff
$FILE - && msgpass
|| msgfail
1008 echo "$*" | checkdiff
$FILE - && msgpass
|| msgfail
1013 msgtest
"Test for no output of" "$*"
1014 test -z "$($* 2>&1)" && msgpass
|| msgfail
1018 local MSG
='Test of equality of'
1019 if [ "$1" = '--nomsg' ]; then
1024 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1025 echo "$1" > $COMPAREFILE
1028 if [ -n "$MSG" ]; then
1031 $
* 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1035 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1036 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1037 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1038 echo "$1" > $COMPAREFILE1
1039 echo "$2" > $COMPAREFILE2
1041 msgtest
"Test for equality OR of" "$*"
1042 $
* >$COMPAREAGAINST 2>&1 || true
1043 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1044 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1048 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
1049 checkdiff
$COMPAREFILE1 $COMPAREAGAINST || true
1050 echo -n "${CINFO}Diff against OR 2${CNORMAL}"
1051 checkdiff
$COMPAREFILE2 $COMPAREAGAINST || true
1057 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1060 while [ -n "$1" ]; do
1062 N: Can't select versions from package '$1' as it is purely virtual"
1063 PACKAGE
="${PACKAGE} $1"
1066 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1068 N: No packages found"
1069 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1070 local ARCH
="$(getarchitecture 'native')"
1071 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
1072 aptcache show
-q=0 $PACKAGE 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1076 msgtest
"Test for non-existent packages" "apt-cache show $*"
1077 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1078 if [ -n "$SHOWPKG" ]; then
1087 testdpkginstalled
() {
1088 msgtest
"Test for correctly installed package(s) with" "dpkg -l $*"
1089 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
1090 if [ "$PKGS" != $# ]; then
1092 dpkg
-l "$@" | grep '^[a-z]' >&2
1099 testdpkgnotinstalled
() {
1100 msgtest
"Test for correctly not-installed package(s) with" "dpkg -l $*"
1101 local PKGS
="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
1102 if [ "$PKGS" != 0 ]; then
1104 dpkg
-l "$@" | grep '^[a-z]' >&2
1112 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1113 if [ -n "$1" ]; then
1114 msgtest
'Test for correctly marked as auto-installed' "$*"
1115 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1117 msgtest
'Test for correctly marked as auto-installed' 'no package'
1118 echo -n > $COMPAREFILE
1120 aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1124 if [ "$1" = '--nomsg' ]; then
1127 msgtest
'Test for successful execution of' "$*"
1129 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1130 if $@
>${OUTPUT} 2>&1; then
1140 if [ "$1" = '--nomsg' ]; then
1143 msgtest
'Test for failure in execution of' "$*"
1145 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1146 if $@
>${OUTPUT} 2>&1; then
1155 testwebserverlaststatuscode
() {
1156 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1157 local STATUS
='rootdir/tmp/webserverstatus-statusfile.log'
1158 rm -f "$DOWNLOG" "$STATUS"
1159 msgtest
'Test last status code from the webserver was' "$1"
1160 downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
1161 if [ "$(cat "$STATUS")" = "$1" ]; then
1165 if [ -n "$2" ]; then
1167 echo >&2 '#### Additionally provided output files contain:'
1170 echo >&2 '#### Download log of the status code:'
1172 msgfail
"Status was $(cat "$STATUS")"
1177 echo "STOPPED execution. Press enter to continue"