ensure state-dir exists before coyping cdrom files
[ntk/apt.git] / test / integration / framework
CommitLineData
8d876415
DK
1#!/bin/sh -- # no runable script, just for vi
2
5d76cee1 3EXIT_CODE=0
8c1dd12c 4
8d876415 5# we all like colorful messages
682a3bf7
DK
6if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null && \
7 expr match "$(readlink -f /proc/$$/fd/2)" '/dev/pts/[0-9]\+' > /dev/null; then
8 CERROR="\e[1;31m" # red
9 CWARNING="\e[1;33m" # yellow
10 CMSG="\e[1;32m" # green
11 CINFO="\e[1;96m" # light blue
12 CDEBUG="\e[1;94m" # blue
13 CNORMAL="\e[0;39m" # default system console color
14 CDONE="\e[1;32m" # green
15 CPASS="\e[1;32m" # green
16 CFAIL="\e[1;31m" # red
17 CCMD="\e[1;35m" # pink
18fi
8d876415
DK
19
20msgdie() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; }
21msgwarn() { echo "${CWARNING}W: $1${CNORMAL}" >&2; }
22msgmsg() { echo "${CMSG}$1${CNORMAL}" >&2; }
23msginfo() { echo "${CINFO}I: $1${CNORMAL}" >&2; }
24msgdebug() { echo "${CDEBUG}D: $1${CNORMAL}" >&2; }
25msgdone() { echo "${CDONE}DONE${CNORMAL}" >&2; }
26msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; }
27msgnmsg() { echo -n "${CMSG}$1${CNORMAL}" >&2; }
28msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}" >&2; }
29msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}" >&2; }
2a2a7ef4
DK
30msgtest() {
31 while [ -n "$1" ]; do
32 echo -n "${CINFO}$1${CCMD} " >&2;
33 echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " >&2;
d73840dc
DK
34 shift
35 if [ -n "$1" ]; then shift; else break; fi
2a2a7ef4
DK
36 done
37 echo -n "…${CNORMAL} " >&2;
38}
8d876415
DK
39msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; }
40msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
5d76cee1 41msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); }
8d876415
DK
42
43# enable / disable Debugging
fc89263e
DK
44MSGLEVEL=${MSGLEVEL:-3}
45if [ $MSGLEVEL -le 0 ]; then
46 msgdie() { true; }
47fi
48if [ $MSGLEVEL -le 1 ]; then
49 msgwarn() { true; }
50 msgnwarn() { true; }
51fi
52if [ $MSGLEVEL -le 2 ]; then
53 msgmsg() { true; }
54 msgnmsg() { true; }
39cc8228
DK
55 msgtest() { true; }
56 msgpass() { echo -n " ${CPASS}P${CNORMAL}" >&2; }
57 msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; }
682a3bf7
DK
58 if [ -n "$CFAIL" ]; then
59 msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; }
60 else
61 msgfail() { echo -n " ###FAILED###" >&2; }
62 fi
fc89263e
DK
63fi
64if [ $MSGLEVEL -le 3 ]; then
65 msginfo() { true; }
66 msgninfo() { true; }
67fi
68if [ $MSGLEVEL -le 4 ]; then
69 msgdebug() { true; }
70 msgndebug() { true; }
71fi
72msgdone() {
73 if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
74 [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
75 [ "$1" = "msg" -a $MSGLEVEL -le 2 ] ||
76 [ "$1" = "warn" -a $MSGLEVEL -le 1 ] ||
77 [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
78 true;
79 else
80 echo "${CDONE}DONE${CNORMAL}" >&2;
81 fi
82}
8d876415
DK
83
84runapt() {
85 msgdebug "Executing: ${CCMD}$*${CDEBUG} "
7d0627b6
DK
86 if [ -f ./aptconfig.conf ]; then
87 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
4b2a4ab8
MV
88 elif [ -f ../aptconfig.conf ]; then
89 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
7d0627b6
DK
90 else
91 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
92 fi
8d876415
DK
93}
94aptconfig() { runapt apt-config $*; }
95aptcache() { runapt apt-cache $*; }
c45233ea 96aptcdrom() { runapt apt-cdrom $*; }
8d876415
DK
97aptget() { runapt apt-get $*; }
98aptftparchive() { runapt apt-ftparchive $*; }
1f8b2599 99aptkey() { runapt apt-key $*; }
ec7f904e 100aptmark() { runapt apt-mark $*; }
158fda31
DK
101dpkg() {
102 $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $*
103}
b6b5a542
DK
104aptitude() {
105 if [ -f ./aptconfig.conf ]; then
106 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $*
107 elif [ -f ../aptconfig.conf ]; then
108 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $*
109 else
110 LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $*
111 fi
112}
3fa950f1
DK
113gdb() {
114 echo "gdb: run »$*«"
115 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1
116}
8d876415 117
8c1dd12c 118exitwithstatus() {
f91bd741
MV
119 # error if we about to overflow, but ...
120 # "255 failures ought to be enough for everybody"
5d76cee1
MV
121 if [ $EXIT_CODE -gt 255 ]; then
122 msgdie "Total failure count $EXIT_CODE too big"
f91bd741 123 fi
5d76cee1 124 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
8c1dd12c
MV
125}
126
b720d0bd 127addtrap() {
8437b7d4
DK
128 if [ "$1" = 'prefix' ]; then
129 CURRENTTRAP="$2 $CURRENTTRAP"
130 else
131 CURRENTTRAP="$CURRENTTRAP $1"
132 fi
8c1dd12c 133 trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
b720d0bd 134}
8d876415
DK
135
136setupenvironment() {
75954ae2 137 TMPWORKINGDIRECTORY=$(mktemp -d)
53ea1b56 138 TESTDIRECTORY=$(readlink -f $(dirname $0))
3cbbda3c 139 msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
53ea1b56 140 BUILDDIRECTORY="${TESTDIRECTORY}/../../build/bin"
8d876415 141 test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
8437b7d4 142 addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;"
8d876415 143 cd $TMPWORKINGDIRECTORY
cd725954 144 mkdir rootdir aptarchive keys
8d876415 145 cd rootdir
b29c3712
DK
146 mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d
147 mkdir -p var/cache var/lib var/log
cffea9af 148 mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers
cd725954 149 touch var/lib/dpkg/available
8d876415
DK
150 mkdir -p usr/lib/apt
151 ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods
152 cd ..
2c6baa5a 153 local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
53ea1b56
DK
154 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
155 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
8f8169ac 156 fi
4a4ea26c 157 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
53ea1b56
DK
158 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
159 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources
8f8169ac 160 fi
53ea1b56 161 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys/
cd725954 162 ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
cffea9af 163 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
94eb3bee 164 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
8d876415
DK
165 echo "Debug::NoLocking \"true\";" >> aptconfig.conf
166 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
f425d4d5 167 echo "Dir::Bin::Methods \"${BUILDDIRECTORY}/methods\";" >> aptconfig.conf
cffea9af
DK
168 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
169 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
170 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
171 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
172 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
c204d148 173 if ! $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then
53ea1b56
DK
174 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
175 fi
cffea9af 176 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
2c085486 177 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
8d876415 178 export LC_ALL=C
7f52cf7b 179 export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
8d876415
DK
180 msgdone "info"
181}
182
ea65d079
DK
183getarchitecture() {
184 if [ "$1" = "native" -o -z "$1" ]; then
185 eval `aptconfig shell ARCH APT::Architecture`
186 if [ -n "$ARCH" ]; then
187 echo $ARCH
188 else
5834d7a1 189 dpkg --print-architecture
ea65d079
DK
190 fi
191 else
192 echo $1
193 fi
194}
195
53ea1b56
DK
196getarchitectures() {
197 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
198}
199
8d876415
DK
200configarchitecture() {
201 local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
234675b7 202 rm -f $CONFFILE
ea65d079 203 echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
8d876415
DK
204 shift
205 while [ -n "$1" ]; do
ea65d079 206 echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
8d876415
DK
207 shift
208 done
53ea1b56
DK
209 configdpkg
210}
211
212configdpkg() {
213 if [ ! -e rootdir/var/lib/dpkg/status ]; then
214 local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
215 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
216 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
217 else
218 echo -n > rootdir/var/lib/dpkg/status
219 fi
220 fi
c204d148 221 if $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then
53ea1b56
DK
222 local ARCHS="$(getarchitectures)"
223 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
224 DPKGARCH="$(dpkg --print-architecture)"
225 for ARCH in ${ARCHS}; do
226 if [ "${ARCH}" != "${DPKGARCH}" ]; then dpkg --add-architecture ${ARCH}; fi
227 done
228 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
05343a22
DK
229 # dpkg doesn't really check the version as long as it is fully installed,
230 # but just to be sure we choose one above the required version
231 insertinstalledpackage 'dpkg' "all" '1.16.2+fake'
53ea1b56
DK
232 fi
233 fi
234 fi
8d876415
DK
235}
236
75954ae2 237setupsimplenativepackage() {
ce9864a8
DK
238 local NAME="$1"
239 local ARCH="$2"
240 local VERSION="$3"
241 local RELEASE="${4:-unstable}"
242 local DEPENDENCIES="$5"
243 local DESCRIPTION="$6"
b7899b00
DK
244 local SECTION="${7:-others}"
245 local DISTSECTION
246 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
247 DISTSECTION="main"
248 else
249 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
250 fi
ce9864a8
DK
251 local BUILDDIR=incoming/${NAME}-${VERSION}
252 mkdir -p ${BUILDDIR}/debian/source
253 cd ${BUILDDIR}
254 echo "* most suckless software product ever" > FEATURES
b7899b00
DK
255 test -e debian/copyright || echo "Copyleft by Joe Sixpack $(date +%Y)" > debian/copyright
256 test -e debian/changelog || echo "$NAME ($VERSION) $RELEASE; urgency=low
ce9864a8
DK
257
258 * Initial release
259
b7899b00
DK
260 -- Joe Sixpack <joe@example.org> $(date -R)" > debian/changelog
261 test -e debian/control || echo "Source: $NAME
262Section: $SECTION
ce9864a8
DK
263Priority: optional
264Maintainer: Joe Sixpack <joe@example.org>
265Build-Depends: debhelper (>= 7)
266Standards-Version: 3.9.1
267
875bcb36
DK
268Package: $NAME" > debian/control
269 if [ "$ARCH" = 'all' ]; then
270 echo "Architecture: all" >> debian/control
271 else
272 echo "Architecture: any" >> debian/control
273 fi
ce9864a8
DK
274 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control
275 if [ -z "$DESCRIPTION" ]; then
276 echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
277 If you find such a package installed on your system,
278 YOU did something horribly wrong! They are autogenerated
279 und used only by testcases for APT and surf no other propose…" >> debian/control
280 else
281 echo "Description: $DESCRIPTION" >> debian/control
282 fi
b7899b00
DK
283 test -e debian/compat || echo "7" > debian/compat
284 test -e debian/source/format || echo "3.0 (native)" > debian/source/format
ce9864a8 285 test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules
75954ae2
DK
286 cd - > /dev/null
287}
288
289buildsimplenativepackage() {
290 local NAME="$1"
291 local ARCH="$2"
292 local VERSION="$3"
293 local RELEASE="${4:-unstable}"
294 local DEPENDENCIES="$5"
295 local DESCRIPTION="$6"
296 local SECTION="${7:-others}"
d67004e0 297 local PRIORITY="${8:-optional}"
75954ae2
DK
298 local DISTSECTION
299 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
300 DISTSECTION="main"
301 else
302 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
303 fi
5a635ee4 304 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
b761356f 305
18331adf 306 msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… "
b761356f
DK
307 mkdir -p $BUILDDIR/debian/source
308 echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES
309 echo "#!/bin/sh
310echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
311
312 echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright
313 echo "$NAME ($VERSION) $RELEASE; urgency=low
314
315 * Initial release
316
317 -- Joe Sixpack <joe@example.org> $(date -R)" > ${BUILDDIR}/debian/changelog
318 echo "Source: $NAME
319Section: $SECTION
d67004e0 320Priority: $PRIORITY
b761356f 321Maintainer: Joe Sixpack <joe@example.org>
01f520ce
DK
322Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control
323 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
324 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
325 echo "
326Package: $NAME" >> ${BUILDDIR}/debian/control
b761356f 327
875bcb36
DK
328 if [ "$ARCH" = 'all' ]; then
329 echo "Architecture: all" >> ${BUILDDIR}/debian/control
330 else
331 echo "Architecture: any" >> ${BUILDDIR}/debian/control
332 fi
01f520ce
DK
333 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
334 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
b761356f
DK
335 if [ -z "$DESCRIPTION" ]; then
336 echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
337 If you find such a package installed on your system,
338 YOU did something horribly wrong! They are autogenerated
339 und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
340 else
01f520ce 341 echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
b761356f 342 fi
01f520ce 343
b761356f 344 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
f1828b69
DK
345 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
346 | while read SRC; do
5a635ee4 347 echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
f1828b69
DK
348# if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
349# gpg --yes --no-default-keyring --secret-keyring ./keys/joesixpack.sec \
350# --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
351# --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
352# mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
353# fi
b761356f 354 done
84aa13f4 355
ea65d079 356 for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
84aa13f4
DK
357 rm -rf ${BUILDDIR}/debian/tmp
358 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
359 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
360 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
361 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
362 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
363
364 dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
365 echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
366 done
367
13845042
DK
368 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
369 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
370 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
5a635ee4 371 rm -rf "${BUILDDIR}"
b761356f 372 msgdone "info"
75954ae2
DK
373}
374
375buildpackage() {
376 local BUILDDIR=$1
377 local RELEASE=$2
378 local SECTION=$3
ea65d079 379 local ARCH=$(getarchitecture $4)
75954ae2
DK
380 msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… "
381 cd $BUILDDIR
382 if [ "$ARCH" = "all" ]; then
383 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
384 fi
b7899b00
DK
385 local BUILT="$(dpkg-buildpackage -uc -us -a$ARCH 2> /dev/null)"
386 local PKGS="$( echo "$BUILT" | grep '^dpkg-deb: building package' | cut -d'/' -f 2 | sed -e "s#'\.##")"
5ed56f93 387 local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
ce9864a8 388 cd - > /dev/null
b7899b00 389 for PKG in $PKGS; do
75954ae2 390 echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
b7899b00
DK
391 done
392 for SRC in $SRCS; do
75954ae2 393 echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
b7899b00 394 done
cffea9af 395 msgdone "info"
ce9864a8
DK
396}
397
398buildaptarchive() {
ce9864a8
DK
399 if [ -d incoming ]; then
400 buildaptarchivefromincoming $*
401 else
402 buildaptarchivefromfiles $*
403 fi
404}
405
406createaptftparchiveconfig() {
407 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' ' ')"
158fda31
DK
408 if [ -z "$ARCHS" ]; then
409 # the pool is empty, so we will operate on faked packages - let us use the configured archs
53ea1b56 410 ARCHS="$(getarchitectures)"
158fda31 411 fi
ce9864a8
DK
412 echo -n 'Dir {
413 ArchiveDir "' >> ftparchive.conf
414 echo -n $(readlink -f .) >> ftparchive.conf
415 echo -n '";
416 CacheDir "' >> ftparchive.conf
417 echo -n $(readlink -f ..) >> ftparchive.conf
418 echo -n '";
b7899b00
DK
419 FileListDir "' >> ftparchive.conf
420 echo -n $(readlink -f pool/) >> ftparchive.conf
421 echo -n '";
422};
423Default {
bc33e0f0
DK
424 Packages::Compress ". gzip bzip2 lzma xz";
425 Sources::Compress ". gzip bzip2 lzma xz";
426 Contents::Compress ". gzip bzip2 lzma xz";
b7080ced 427 Translation::Compress ". gzip bzip2 lzma xz";
18331adf 428 LongDescription "false";
ce9864a8
DK
429};
430TreeDefault {
431 Directory "pool/";
432 SrcDirectory "pool/";
433};
434APT {
435 FTPArchive {
436 Release {
437 Origin "joesixpack";
438 Label "apttestcases";
439 Suite "unstable";
440 Description "repository with dummy packages";
441 Architectures "' >> ftparchive.conf
442 echo -n "$ARCHS" >> ftparchive.conf
443 echo 'source";
444 };
445 };
446};' >> ftparchive.conf
b7899b00
DK
447 for DIST in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
448 echo -n 'tree "dists/' >> ftparchive.conf
449 echo -n "$DIST" >> ftparchive.conf
450 echo -n '" {
ce9864a8
DK
451 Architectures "' >> ftparchive.conf
452 echo -n "$ARCHS" >> ftparchive.conf
b7899b00
DK
453 echo -n 'source";
454 FileList "' >> ftparchive.conf
455 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
456 echo -n '";
457 SourceFileList "' >> ftparchive.conf
458 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
459 echo -n '";
460 Sections "' >> ftparchive.conf
461 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
462 echo '";
ce9864a8 463};' >> ftparchive.conf
b7899b00 464 done
ce9864a8
DK
465}
466
467buildaptftparchivedirectorystructure() {
b7899b00
DK
468 local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
469 for DIST in $DISTS; do
470 local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
471 for SECTION in $SECTIONS; do
472 local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
473 for ARCH in $ARCHS; do
474 mkdir -p dists/${DIST}/${SECTION}/binary-${ARCH}
475 done
476 mkdir -p dists/${DIST}/${SECTION}/source
477 mkdir -p dists/${DIST}/${SECTION}/i18n
478 done
ce9864a8 479 done
ce9864a8
DK
480}
481
9b78cda6
DK
482insertpackage() {
483 local RELEASE="$1"
484 local NAME="$2"
485 local ARCH="$3"
486 local VERSION="$4"
487 local DEPENDENCIES="$5"
d67004e0 488 local PRIORITY="${6:-optional}"
8ba17539 489 local DESCRIPTION="${7}"
d67004e0 490 local ARCHS=""
ea65d079 491 for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
c919ad6e 492 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
53ea1b56 493 ARCHS="$(getarchitectures)"
d67004e0
DK
494 else
495 ARCHS="$arch"
496 fi
497 for BUILDARCH in $ARCHS; do
498 local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}"
499 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
500 touch aptarchive/dists/${RELEASE}/main/source/Sources
501 local FILE="${PPATH}/Packages"
502 echo "Package: $NAME
503Priority: $PRIORITY
9b78cda6 504Section: other
2c085486 505Installed-Size: 42
c919ad6e
DK
506Maintainer: Joe Sixpack <joe@example.org>" >> $FILE
507 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
508 echo "Version: $VERSION
d67004e0
DK
509Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
510 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
8ba17539
DK
511 echo -n 'Description: ' >> $FILE
512 if [ -z "$DESCRIPTION" ]; then
513 echo "an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
9b78cda6
DK
514 If you find such a package installed on your system,
515 YOU did something horribly wrong! They are autogenerated
8ba17539
DK
516 und used only by testcases for APT and surf no other propose…" >> $FILE
517 else
518 echo "$DESCRIPTION" >> $FILE
519 fi
520 echo >> $FILE
d67004e0 521 done
9b78cda6
DK
522 done
523}
524
234675b7
DK
525insertsource() {
526 local RELEASE="$1"
527 local NAME="$2"
528 local ARCH="$3"
529 local VERSION="$4"
530 local DEPENDENCIES="$5"
531 local ARCHS=""
532 local SPATH="aptarchive/dists/${RELEASE}/main/source"
533 mkdir -p $SPATH
534 local FILE="${SPATH}/Sources"
535 echo "Package: $NAME
536Binary: $NAME
537Version: $VERSION
538Maintainer: Joe Sixpack <joe@example.org>
539Architecture: $ARCH" >> $FILE
540 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
541 echo "Files:
542 d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc
d5dea0be
DK
543 d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz
544" >> $FILE
234675b7
DK
545}
546
dfc2b1be
DK
547insertinstalledpackage() {
548 local NAME="$1"
549 local ARCH="$2"
550 local VERSION="$3"
551 local DEPENDENCIES="$4"
d67004e0 552 local PRIORITY="${5:-optional}"
d4b4e5ea 553 local STATUS="${6:-install ok installed}"
53ea1b56
DK
554 local FILE='rootdir/var/lib/dpkg/status'
555 local INFO='rootdir/var/lib/dpkg/info'
ea65d079 556 for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
d67004e0 557 echo "Package: $NAME
d4b4e5ea 558Status: $STATUS
d67004e0 559Priority: $PRIORITY
dfc2b1be
DK
560Section: other
561Installed-Size: 42
562Maintainer: Joe Sixpack <joe@example.org>
dfc2b1be 563Version: $VERSION" >> $FILE
c919ad6e 564 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
d67004e0
DK
565 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
566 echo "Description: an autogenerated dummy ${NAME}=${VERSION}/installed
dfc2b1be
DK
567 If you find such a package installed on your system,
568 YOU did something horribly wrong! They are autogenerated
569 und used only by testcases for APT and surf no other propose…
570" >> $FILE
53ea1b56
DK
571 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
572 echo -n > ${INFO}/${NAME}:${arch}.list
573 else
574 echo -n > ${INFO}/${NAME}.list
575 fi
d67004e0 576 done
dfc2b1be
DK
577}
578
579
ce9864a8 580buildaptarchivefromincoming() {
3cbbda3c 581 msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
ce9864a8
DK
582 cd aptarchive
583 [ -e pool ] || ln -s ../incoming pool
584 [ -e ftparchive.conf ] || createaptftparchiveconfig
585 [ -e dists ] || buildaptftparchivedirectorystructure
b7899b00 586 msgninfo "\tGenerate Packages, Sources and Contents files… "
ce9864a8 587 aptftparchive -qq generate ftparchive.conf
ce9864a8
DK
588 cd - > /dev/null
589 msgdone "info"
9b78cda6 590 generatereleasefiles
ce9864a8
DK
591}
592
593buildaptarchivefromfiles() {
3cbbda3c 594 msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
9b78cda6
DK
595 find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do
596 msgninfo "\t${line} file… "
597 cat ${line} | gzip > ${line}.gz
598 cat ${line} | bzip2 > ${line}.bz2
8bcbc694 599 cat ${line} | xz --format=lzma > ${line}.lzma
b7080ced 600 cat ${line} | xz > ${line}.xz
8d876415 601 msgdone "info"
9b78cda6
DK
602 done
603 generatereleasefiles
604}
605
a3bbbab7
DK
606# can be overridden by testcases for their pleasure
607getcodenamefromsuite() { echo -n "$1"; }
608getreleaseversionfromsuite() { true; }
718f797c 609getlabelfromsuite() { true; }
a3bbbab7 610
9b78cda6 611generatereleasefiles() {
884a4c0a
DK
612 # $1 is the Date header and $2 is the ValidUntil header to be set
613 # both should be given in notation date/touch can understand
9b78cda6
DK
614 msgninfo "\tGenerate Release files… "
615 if [ -e aptarchive/dists ]; then
616 for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
a3bbbab7
DK
617 local SUITE="$(echo "$dir" | cut -d'/' -f 4)"
618 local CODENAME="$(getcodenamefromsuite $SUITE)"
619 local VERSION="$(getreleaseversionfromsuite $SUITE)"
718f797c 620 local LABEL="$(getlabelfromsuite $SUITE)"
884a4c0a 621 if [ -n "$VERSION" ]; then
718f797c
DK
622 VERSION="-o APT::FTPArchive::Release::Version=${VERSION}"
623 fi
624 if [ -n "$LABEL" ]; then
625 LABEL="-o APT::FTPArchive::Release::Label=${LABEL}"
a3bbbab7 626 fi
884a4c0a
DK
627 aptftparchive -qq release $dir \
628 -o APT::FTPArchive::Release::Suite="${SUITE}" \
629 -o APT::FTPArchive::Release::Codename="${CODENAME}" \
718f797c 630 ${LABEL} \
884a4c0a
DK
631 ${VERSION} \
632 | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
a3bbbab7 633 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
35faae11
DK
634 sed -i '/^Date: / a\
635NotAutomatic: yes' $dir/Release
636 fi
884a4c0a
DK
637 if [ -n "$1" -a "$1" != "now" ]; then
638 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
639 fi
640 if [ -n "$2" ]; then
641 sed -i "/^Date: / a\
642Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
643 fi
9b78cda6
DK
644 done
645 else
646 aptftparchive -qq release ./aptarchive | sed -e '/0 Release$/ d' > aptarchive/Release # remove the self reference
8d876415 647 fi
884a4c0a 648 if [ -n "$1" -a "$1" != "now" ]; then
fe0f7911
DK
649 for release in $(find ./aptarchive -name 'Release'); do
650 touch -d "$1" $release
651 done
8d876415 652 fi
b7899b00 653 msgdone "info"
8d876415
DK
654}
655
b7899b00
DK
656setupdistsaptarchive() {
657 local APTARCHIVE=$(readlink -f ./aptarchive)
658 rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list
659 rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list
660 for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
661 SECTIONS=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
662 msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
663 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list
664 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list
665 msgdone "info"
666 done
667}
668
669setupflataptarchive() {
ce9864a8 670 local APTARCHIVE=$(readlink -f ./aptarchive)
8d876415
DK
671 if [ -f ${APTARCHIVE}/Packages ]; then
672 msgninfo "\tadd deb sources.list line… "
673 echo "deb file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list
674 msgdone "info"
675 else
676 rm -f rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list
677 fi
678 if [ -f ${APTARCHIVE}/Sources ]; then
679 msgninfo "\tadd deb-src sources.list line… "
680 echo "deb-src file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list
681 msgdone "info"
682 else
683 rm -f rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list
684 fi
b7899b00
DK
685}
686
687setupaptarchive() {
688 buildaptarchive
689 if [ -e aptarchive/dists ]; then
690 setupdistsaptarchive
691 else
692 setupflataptarchive
693 fi
f213b6ea 694 signreleasefiles
b2ea1a47
DK
695 if [ "$1" != '--no-update' ]; then
696 msgninfo "\tSync APT's cache with the archive… "
697 aptget update -qq
698 msgdone "info"
699 fi
8d876415
DK
700}
701
f213b6ea
DK
702signreleasefiles() {
703 local SIGNER="${1:-Joe Sixpack}"
704 msgninfo "\tSign archive with $SIGNER key… "
705 local SECKEYS=""
706 for KEY in $(find keys/ -name '*.sec'); do
707 SECKEYS="$SECKEYS --secret-keyring $KEY"
708 done
709 local PUBKEYS=""
710 for KEY in $(find keys/ -name '*.pub'); do
711 PUBKEYS="$PUBKEYS --keyring $KEY"
712 done
713 for RELEASE in $(find aptarchive/ -name Release); do
714 gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" -abs -o ${RELEASE}.gpg ${RELEASE}
fe0f7911 715 gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" --clearsign -o "$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" $RELEASE
f213b6ea
DK
716 done
717 msgdone "info"
718}
719
720changetowebserver() {
721 if which weborf > /dev/null; then
722 weborf -xb aptarchive/ 2>&1 > /dev/null &
b720d0bd 723 addtrap "kill $!;"
6e7d39d0
DK
724 elif which gatling > /dev/null; then
725 cd aptarchive
726 gatling -p 8080 -F -S 2>&1 > /dev/null &
727 addtrap "kill $!;"
728 cd - > /dev/null
c5bcc607
DK
729 elif which lighttpd > /dev/null; then
730 echo "server.document-root = \"$(readlink -f ./aptarchive)\"
731server.port = 8080
732server.stat-cache-engine = \"disable\"" > lighttpd.conf
733 lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid'
734 lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null &
735 addtrap "kill $!;"
736 else
737 msgdie 'You have to install weborf or lighttpd first'
738 return 1
f213b6ea 739 fi
c5bcc607
DK
740 local APTARCHIVE="file://$(readlink -f ./aptarchive)"
741 for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
742 sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#"
743 done
744 return 0
f213b6ea
DK
745}
746
c45233ea
DK
747changetocdrom() {
748 mkdir -p rootdir/media/cdrom/.disk
749 local CD="$(readlink -f rootdir/media/cdrom)"
750 echo "acquire::cdrom::mount \"${CD}\";" > rootdir/etc/apt/apt.conf.d/00cdrom
751 echo 'acquire::cdrom::autodetect 0;' >> rootdir/etc/apt/apt.conf.d/00cdrom
752 echo -n "$1" > ${CD}/.disk/info
753 if [ ! -d aptarchive/dists ]; then
754 msgdie 'Flat file archive cdroms can not be created currently'
755 return 1
756 fi
757 mv aptarchive/dists $CD
758 ln -s "$(readlink -f ./incoming)" $CD/pool
759 find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete
760}
761
f213b6ea 762checkdiff() {
8d876415
DK
763 local DIFFTEXT="$($(which diff) -u $* | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
764 if [ -n "$DIFFTEXT" ]; then
765 echo
766 echo "$DIFFTEXT"
767 return 1
768 else
769 return 0
770 fi
771}
772
75954ae2
DK
773testfileequal() {
774 local FILE="$1"
775 shift
776 msgtest "Test for correctness of file" "$FILE"
777 if [ -z "$*" ]; then
f213b6ea 778 echo -n "" | checkdiff $FILE - && msgpass || msgfail
75954ae2 779 else
f213b6ea 780 echo "$*" | checkdiff $FILE - && msgpass || msgfail
75954ae2
DK
781 fi
782}
783
b855a400
DK
784testempty() {
785 msgtest "Test for no output of" "$*"
786 test -z "$($* 2>&1)" && msgpass || msgfail
787}
788
8d876415
DK
789testequal() {
790 local COMPAREFILE=$(mktemp)
b720d0bd 791 addtrap "rm $COMPAREFILE;"
8d876415
DK
792 echo "$1" > $COMPAREFILE
793 shift
794 msgtest "Test for equality of" "$*"
f213b6ea 795 $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
8d876415
DK
796}
797
685625bd
DK
798testequalor2() {
799 local COMPAREFILE1=$(mktemp)
800 local COMPAREFILE2=$(mktemp)
801 local COMPAREAGAINST=$(mktemp)
b720d0bd 802 addtrap "rm $COMPAREFILE1 $COMPAREFILE2 $COMPAREAGAINST;"
685625bd
DK
803 echo "$1" > $COMPAREFILE1
804 echo "$2" > $COMPAREFILE2
805 shift 2
806 msgtest "Test for equality OR of" "$*"
807 $* 2>&1 1> $COMPAREAGAINST
f213b6ea
DK
808 (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null ||
809 checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass ||
810 ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \
811 "\n${CINFO}Diff against OR 2${CNORMAL}" "$(checkdiff $COMPAREFILE2 $COMPAREAGAINST)" &&
685625bd
DK
812 msgfail )
813}
814
8d876415 815testshowvirtual() {
edc0ef10 816 local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual"
8d876415
DK
817 local PACKAGE="$1"
818 shift
819 while [ -n "$1" ]; do
820 VIRTUAL="${VIRTUAL}
edc0ef10 821N: Can't select versions from package '$1' as it is purely virtual"
8d876415
DK
822 PACKAGE="${PACKAGE} $1"
823 shift
824 done
825 msgtest "Test for virtual packages" "apt-cache show $PACKAGE"
826 VIRTUAL="${VIRTUAL}
4bec02c2 827N: No packages found"
8d876415 828 local COMPAREFILE=$(mktemp)
b720d0bd 829 addtrap "rm $COMPAREFILE;"
ea65d079 830 local ARCH="$(getarchitecture 'native')"
8d876415 831 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
e8379ba3 832 aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
8d876415
DK
833}
834
835testnopackage() {
836 msgtest "Test for non-existent packages" "apt-cache show $*"
837 local SHOWPKG="$(aptcache show $* 2>&1 | grep '^Package: ')"
838 if [ -n "$SHOWPKG" ]; then
839 echo
840 echo "$SHOWPKG"
841 msgfail
842 return 1
843 fi
844 msgpass
845}
01a6e24c
DK
846
847testdpkginstalled() {
848 msgtest "Test for correctly installed package(s) with" "dpkg -l $*"
c919ad6e 849 local PKGS="$(dpkg -l $* 2>/dev/null | grep '^i' | wc -l)"
87bc1c45 850 if [ "$PKGS" != $# ]; then
01a6e24c
DK
851 echo $PKGS
852 dpkg -l $* | grep '^[a-z]'
853 msgfail
854 return 1
855 fi
856 msgpass
857}
858
5cf733e1
DK
859testdpkgnotinstalled() {
860 msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*"
87bc1c45 861 local PKGS="$(dpkg -l $* 2> /dev/null | grep '^i' | wc -l)"
01a6e24c
DK
862 if [ "$PKGS" != 0 ]; then
863 echo
864 dpkg -l $* | grep '^[a-z]'
865 msgfail
866 return 1
867 fi
868 msgpass
869}
ec7f904e
DK
870
871testmarkedauto() {
872 local COMPAREFILE=$(mktemp)
873 addtrap "rm $COMPAREFILE;"
874 if [ -n "$1" ]; then
875 msgtest 'Test for correctly marked as auto-installed' "$*"
876 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
877 else
878 msgtest 'Test for correctly marked as auto-installed' 'no package'
c98fb5e0 879 echo -n > $COMPAREFILE
ec7f904e
DK
880 fi
881 aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
882}
89a1aa5d
DK
883
884pause() {
885 echo "STOPPED execution. Press enter to continue"
886 local IGNORE
887 read IGNORE
888}