]>
Commit | Line | Data |
---|---|---|
8d876415 DK |
1 | #!/bin/sh -- # no runable script, just for vi |
2 | ||
5d76cee1 | 3 | EXIT_CODE=0 |
8c1dd12c | 4 | |
8d876415 | 5 | # we all like colorful messages |
1290422a DK |
6 | if [ "$MSGCOLOR" != 'NO' ]; then |
7 | if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then | |
8 | export MSGCOLOR='NO' | |
9 | fi | |
10 | fi | |
11 | ||
12 | ||
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 | |
682a3bf7 | 24 | fi |
8d876415 DK |
25 | |
26 | msgdie() { echo "${CERROR}E: $1${CNORMAL}" >&2; exit 1; } | |
27 | msgwarn() { echo "${CWARNING}W: $1${CNORMAL}" >&2; } | |
0954c58e DK |
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}"; } | |
8d876415 | 32 | msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; } |
0954c58e DK |
33 | msgnmsg() { echo -n "${CMSG}$1${CNORMAL}"; } |
34 | msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}"; } | |
35 | msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}"; } | |
2a2a7ef4 DK |
36 | msgtest() { |
37 | while [ -n "$1" ]; do | |
0954c58e DK |
38 | echo -n "${CINFO}$1${CCMD} " |
39 | echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " | |
d73840dc DK |
40 | shift |
41 | if [ -n "$1" ]; then shift; else break; fi | |
2a2a7ef4 | 42 | done |
0954c58e | 43 | echo -n "…${CNORMAL} " |
2a2a7ef4 | 44 | } |
0954c58e | 45 | msgpass() { echo "${CPASS}PASS${CNORMAL}"; } |
8d876415 | 46 | msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; } |
5229b285 DK |
47 | msgfail() { |
48 | if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2; | |
49 | else echo "${CFAIL}FAIL${CNORMAL}" >&2; fi | |
50 | EXIT_CODE=$((EXIT_CODE+1)); | |
51 | } | |
8d876415 DK |
52 | |
53 | # enable / disable Debugging | |
fc89263e DK |
54 | MSGLEVEL=${MSGLEVEL:-3} |
55 | if [ $MSGLEVEL -le 0 ]; then | |
56 | msgdie() { true; } | |
57 | fi | |
58 | if [ $MSGLEVEL -le 1 ]; then | |
59 | msgwarn() { true; } | |
60 | msgnwarn() { true; } | |
61 | fi | |
62 | if [ $MSGLEVEL -le 2 ]; then | |
63 | msgmsg() { true; } | |
64 | msgnmsg() { true; } | |
39cc8228 | 65 | msgtest() { true; } |
0954c58e | 66 | msgpass() { echo -n " ${CPASS}P${CNORMAL}"; } |
39cc8228 | 67 | msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; } |
682a3bf7 | 68 | if [ -n "$CFAIL" ]; then |
5229b285 | 69 | msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } |
682a3bf7 | 70 | else |
5229b285 | 71 | msgfail() { echo -n " ###FAILED###" >&2; EXIT_CODE=$((EXIT_CODE+1)); } |
682a3bf7 | 72 | fi |
fc89263e DK |
73 | fi |
74 | if [ $MSGLEVEL -le 3 ]; then | |
75 | msginfo() { true; } | |
76 | msgninfo() { true; } | |
77 | fi | |
78 | if [ $MSGLEVEL -le 4 ]; then | |
79 | msgdebug() { true; } | |
80 | msgndebug() { true; } | |
81 | fi | |
82 | msgdone() { | |
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 | |
88 | true; | |
89 | else | |
0954c58e | 90 | echo "${CDONE}DONE${CNORMAL}"; |
fc89263e DK |
91 | fi |
92 | } | |
e43a426e MV |
93 | getaptconfig() { |
94 | if [ -f ./aptconfig.conf ]; then | |
95 | echo "./aptconfig.conf" | |
96 | elif [ -f ../aptconfig.conf ]; then | |
97 | echo "../aptconfig.conf" | |
98 | fi | |
99 | } | |
8d876415 DK |
100 | runapt() { |
101 | msgdebug "Executing: ${CCMD}$*${CDEBUG} " | |
846856f4 DK |
102 | local CMD="$1" |
103 | shift | |
3b8eb3bc DK |
104 | case $CMD in |
105 | sh|aptitude|*/*) ;; | |
106 | *) CMD="${BUILDDIRECTORY}/$CMD";; | |
107 | esac | |
83b880c6 | 108 | MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@" |
8d876415 | 109 | } |
846856f4 DK |
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 "$@"; } | |
796673c3 | 117 | apt() { runapt apt "$@"; } |
3b8eb3bc DK |
118 | apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } |
119 | aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } | |
120 | aptitude() { runapt aptitude "$@"; } | |
8d50b63f | 121 | aptextracttemplates() { runapt apt-extracttemplates "$@"; } |
3b8eb3bc | 122 | |
158fda31 | 123 | dpkg() { |
846856f4 | 124 | command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" |
158fda31 | 125 | } |
ce7f128c DK |
126 | dpkgcheckbuilddeps() { |
127 | command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" | |
b6b5a542 | 128 | } |
3fa950f1 DK |
129 | gdb() { |
130 | echo "gdb: run »$*«" | |
3b8eb3bc | 131 | APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@" |
ae99ce2e | 132 | } |
77a45beb DK |
133 | gpg() { |
134 | # see apt-key for the whole trickery. Setup is done in setupenvironment | |
135 | command gpg --ignore-time-conflict --no-options --no-default-keyring \ | |
136 | --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \ | |
137 | --no-auto-check-trustdb --trust-model always \ | |
138 | "$@" | |
139 | } | |
8d876415 | 140 | |
8c1dd12c | 141 | exitwithstatus() { |
f91bd741 MV |
142 | # error if we about to overflow, but ... |
143 | # "255 failures ought to be enough for everybody" | |
5d76cee1 MV |
144 | if [ $EXIT_CODE -gt 255 ]; then |
145 | msgdie "Total failure count $EXIT_CODE too big" | |
f91bd741 | 146 | fi |
5d76cee1 | 147 | exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); |
8c1dd12c MV |
148 | } |
149 | ||
804d4a0d DK |
150 | shellsetedetector() { |
151 | local exit_status=$? | |
152 | if [ "$exit_status" != '0' ]; then | |
153 | echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}" | |
154 | if [ "$EXIT_CODE" = '0' ]; then | |
155 | EXIT_CODE="$exit_status" | |
156 | fi | |
157 | fi | |
158 | } | |
159 | ||
b720d0bd | 160 | addtrap() { |
8437b7d4 DK |
161 | if [ "$1" = 'prefix' ]; then |
162 | CURRENTTRAP="$2 $CURRENTTRAP" | |
163 | else | |
164 | CURRENTTRAP="$CURRENTTRAP $1" | |
165 | fi | |
804d4a0d | 166 | trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM |
b720d0bd | 167 | } |
8d876415 DK |
168 | |
169 | setupenvironment() { | |
75954ae2 | 170 | TMPWORKINGDIRECTORY=$(mktemp -d) |
53ea1b56 | 171 | TESTDIRECTORY=$(readlink -f $(dirname $0)) |
3cbbda3c | 172 | msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " |
5c0dd6fc MV |
173 | |
174 | # allow overriding the default BUILDDIR location | |
175 | BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} | |
3b8eb3bc | 176 | LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"} |
5c0dd6fc | 177 | METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} |
e43a426e | 178 | APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} |
c035b655 | 179 | APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} |
8d876415 | 180 | test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" |
5c0dd6fc MV |
181 | # ----- |
182 | ||
8437b7d4 | 183 | addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" |
8d876415 | 184 | cd $TMPWORKINGDIRECTORY |
cd725954 | 185 | mkdir rootdir aptarchive keys |
8d876415 | 186 | cd rootdir |
b29c3712 | 187 | mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d |
33677a0c | 188 | mkdir -p var/cache var/lib/apt var/log tmp |
cffea9af | 189 | mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers |
cd725954 | 190 | touch var/lib/dpkg/available |
8d876415 | 191 | mkdir -p usr/lib/apt |
9082a1fc | 192 | ln -s ${METHODSDIR} usr/lib/apt/methods |
b9b0f622 | 193 | ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove |
8d876415 | 194 | cd .. |
2c6baa5a | 195 | local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') |
53ea1b56 DK |
196 | if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then |
197 | cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages | |
8f8169ac | 198 | fi |
4a4ea26c | 199 | local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/') |
53ea1b56 DK |
200 | if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then |
201 | cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources | |
8f8169ac | 202 | fi |
53ea1b56 | 203 | cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys/ |
cd725954 | 204 | ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg |
cffea9af | 205 | echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf |
94eb3bee | 206 | echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf |
8d876415 DK |
207 | echo "Debug::NoLocking \"true\";" >> aptconfig.conf |
208 | echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf | |
5c0dd6fc | 209 | echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf |
cffea9af DK |
210 | echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf |
211 | echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf | |
212 | echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf | |
213 | echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf | |
214 | echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf | |
846856f4 | 215 | if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then |
53ea1b56 DK |
216 | echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it… |
217 | fi | |
cffea9af | 218 | echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf |
2c085486 | 219 | echo 'quiet::NoUpdate "true";' >> aptconfig.conf |
23af9f40 | 220 | echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https |
14109555 | 221 | echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary |
276e51dd | 222 | configcompression '.' 'gz' #'bz2' 'lzma' 'xz' |
77a45beb DK |
223 | |
224 | # gpg needs a trustdb to function, but it can't be invalid (not even empty) | |
225 | # see also apt-key where this trickery comes from: | |
226 | local TRUSTDBDIR="${TMPWORKINGDIRECTORY}/gnupghome" | |
227 | mkdir "$TRUSTDBDIR" | |
228 | chmod 700 "$TRUSTDBDIR" | |
229 | # We also don't use a secret keyring, of course, but gpg panics and | |
230 | # implodes if there isn't one available - and writeable for imports | |
231 | local SECRETKEYRING="${TRUSTDBDIR}/secring.gpg" | |
232 | touch $SECRETKEYRING | |
233 | # now create the trustdb with an (empty) dummy keyring | |
234 | # newer gpg versions are fine without it, but play it safe for now | |
235 | gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 | |
236 | ||
ce7f128c | 237 | # cleanup the environment a bit |
be233796 DK |
238 | export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" |
239 | export LC_ALL=C.UTF-8 | |
3b8eb3bc | 240 | unset LANGUAGE APT_CONFIG |
ce7f128c DK |
241 | unset GREP_OPTIONS DEB_BUILD_PROFILES |
242 | ||
8d876415 DK |
243 | msgdone "info" |
244 | } | |
245 | ||
ea65d079 DK |
246 | getarchitecture() { |
247 | if [ "$1" = "native" -o -z "$1" ]; then | |
248 | eval `aptconfig shell ARCH APT::Architecture` | |
249 | if [ -n "$ARCH" ]; then | |
250 | echo $ARCH | |
251 | else | |
5834d7a1 | 252 | dpkg --print-architecture |
ea65d079 DK |
253 | fi |
254 | else | |
255 | echo $1 | |
256 | fi | |
257 | } | |
258 | ||
53ea1b56 DK |
259 | getarchitectures() { |
260 | echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" | |
261 | } | |
262 | ||
3dcdc1f9 DK |
263 | getarchitecturesfromcommalist() { |
264 | echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" | |
265 | } | |
266 | ||
8d876415 | 267 | configarchitecture() { |
18908589 DK |
268 | { |
269 | echo "APT::Architecture \"$(getarchitecture $1)\";" | |
270 | while [ -n "$1" ]; do | |
271 | echo "APT::Architectures:: \"$(getarchitecture $1)\";" | |
272 | shift | |
273 | done | |
274 | } >rootdir/etc/apt/apt.conf.d/01multiarch.conf | |
53ea1b56 DK |
275 | configdpkg |
276 | } | |
277 | ||
278 | configdpkg() { | |
279 | if [ ! -e rootdir/var/lib/dpkg/status ]; then | |
280 | local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/') | |
281 | if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then | |
282 | cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status | |
283 | else | |
284 | echo -n > rootdir/var/lib/dpkg/status | |
285 | fi | |
286 | fi | |
18908589 | 287 | rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg |
846856f4 | 288 | if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then |
53ea1b56 DK |
289 | local ARCHS="$(getarchitectures)" |
290 | if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then | |
291 | DPKGARCH="$(dpkg --print-architecture)" | |
292 | for ARCH in ${ARCHS}; do | |
feae193b | 293 | if [ "${ARCH}" != "${DPKGARCH}" ]; then |
18908589 | 294 | if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then |
feae193b | 295 | # old-style used e.g. in Ubuntu-P – and as it seems travis |
18908589 DK |
296 | echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg |
297 | echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg | |
feae193b DK |
298 | fi |
299 | fi | |
53ea1b56 DK |
300 | done |
301 | if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then | |
05343a22 DK |
302 | # dpkg doesn't really check the version as long as it is fully installed, |
303 | # but just to be sure we choose one above the required version | |
304 | insertinstalledpackage 'dpkg' "all" '1.16.2+fake' | |
53ea1b56 DK |
305 | fi |
306 | fi | |
307 | fi | |
8d876415 DK |
308 | } |
309 | ||
276e51dd DK |
310 | configcompression() { |
311 | while [ -n "$1" ]; do | |
312 | case "$1" in | |
313 | '.') echo ".\t.\tcat";; | |
314 | 'gz') echo "gzip\tgz\tgzip";; | |
315 | 'bz2') echo "bzip2\tbz2\tbzip2";; | |
316 | 'lzma') echo "lzma\tlzma\txz --format=lzma";; | |
317 | 'xz') echo "xz\txz\txz";; | |
318 | *) echo "$1\t$1\t$1";; | |
319 | esac | |
320 | shift | |
321 | done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | |
322 | } | |
323 | ||
75954ae2 | 324 | setupsimplenativepackage() { |
ce9864a8 DK |
325 | local NAME="$1" |
326 | local ARCH="$2" | |
327 | local VERSION="$3" | |
328 | local RELEASE="${4:-unstable}" | |
329 | local DEPENDENCIES="$5" | |
14109555 | 330 | local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} |
18908589 DK |
331 | If you find such a package installed on your system, |
332 | something went horribly wrong! They are autogenerated | |
333 | und used only by testcases and surf no other propose…"}" | |
334 | ||
b7899b00 DK |
335 | local SECTION="${7:-others}" |
336 | local DISTSECTION | |
337 | if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then | |
338 | DISTSECTION="main" | |
339 | else | |
340 | DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)" | |
341 | fi | |
ce9864a8 DK |
342 | local BUILDDIR=incoming/${NAME}-${VERSION} |
343 | mkdir -p ${BUILDDIR}/debian/source | |
344 | cd ${BUILDDIR} | |
345 | echo "* most suckless software product ever" > FEATURES | |
b7899b00 DK |
346 | test -e debian/copyright || echo "Copyleft by Joe Sixpack $(date +%Y)" > debian/copyright |
347 | test -e debian/changelog || echo "$NAME ($VERSION) $RELEASE; urgency=low | |
ce9864a8 DK |
348 | |
349 | * Initial release | |
350 | ||
b7899b00 DK |
351 | -- Joe Sixpack <joe@example.org> $(date -R)" > debian/changelog |
352 | test -e debian/control || echo "Source: $NAME | |
353 | Section: $SECTION | |
ce9864a8 DK |
354 | Priority: optional |
355 | Maintainer: Joe Sixpack <joe@example.org> | |
356 | Build-Depends: debhelper (>= 7) | |
357 | Standards-Version: 3.9.1 | |
358 | ||
875bcb36 DK |
359 | Package: $NAME" > debian/control |
360 | if [ "$ARCH" = 'all' ]; then | |
361 | echo "Architecture: all" >> debian/control | |
362 | else | |
363 | echo "Architecture: any" >> debian/control | |
364 | fi | |
ce9864a8 | 365 | test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control |
18908589 DK |
366 | echo "Description: $DESCRIPTION" >> debian/control |
367 | ||
b7899b00 DK |
368 | test -e debian/compat || echo "7" > debian/compat |
369 | test -e debian/source/format || echo "3.0 (native)" > debian/source/format | |
ce9864a8 | 370 | test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules |
75954ae2 DK |
371 | cd - > /dev/null |
372 | } | |
373 | ||
374 | buildsimplenativepackage() { | |
375 | local NAME="$1" | |
376 | local ARCH="$2" | |
377 | local VERSION="$3" | |
378 | local RELEASE="${4:-unstable}" | |
379 | local DEPENDENCIES="$5" | |
14109555 | 380 | local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} |
18908589 DK |
381 | If you find such a package installed on your system, |
382 | something went horribly wrong! They are autogenerated | |
383 | und used only by testcases and surf no other propose…"}" | |
384 | ||
75954ae2 | 385 | local SECTION="${7:-others}" |
d67004e0 | 386 | local PRIORITY="${8:-optional}" |
42c1513b | 387 | local FILE_TREE="$9" |
adff049d | 388 | local COMPRESS_TYPE="${10:-gzip}" |
75954ae2 DK |
389 | local DISTSECTION |
390 | if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then | |
391 | DISTSECTION="main" | |
392 | else | |
393 | DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)" | |
394 | fi | |
5a635ee4 | 395 | local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION} |
b761356f | 396 | |
18331adf | 397 | msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… " |
b761356f DK |
398 | mkdir -p $BUILDDIR/debian/source |
399 | echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES | |
400 | echo "#!/bin/sh | |
401 | echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME} | |
402 | ||
403 | echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright | |
404 | echo "$NAME ($VERSION) $RELEASE; urgency=low | |
405 | ||
406 | * Initial release | |
407 | ||
408 | -- Joe Sixpack <joe@example.org> $(date -R)" > ${BUILDDIR}/debian/changelog | |
409 | echo "Source: $NAME | |
410 | Section: $SECTION | |
d67004e0 | 411 | Priority: $PRIORITY |
b761356f | 412 | Maintainer: Joe Sixpack <joe@example.org> |
01f520ce DK |
413 | Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control |
414 | local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')" | |
415 | test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control | |
416 | echo " | |
417 | Package: $NAME" >> ${BUILDDIR}/debian/control | |
b761356f | 418 | |
875bcb36 DK |
419 | if [ "$ARCH" = 'all' ]; then |
420 | echo "Architecture: all" >> ${BUILDDIR}/debian/control | |
421 | else | |
422 | echo "Architecture: any" >> ${BUILDDIR}/debian/control | |
423 | fi | |
01f520ce DK |
424 | local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')" |
425 | test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control | |
18908589 | 426 | echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control |
01f520ce | 427 | |
b761356f | 428 | echo '3.0 (native)' > ${BUILDDIR}/debian/source/format |
f1828b69 DK |
429 | (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \ |
430 | | while read SRC; do | |
5a635ee4 | 431 | echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist |
f1828b69 | 432 | # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then |
77a45beb | 433 | # gpg --yes --secret-keyring ./keys/joesixpack.sec \ |
f1828b69 DK |
434 | # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \ |
435 | # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" | |
436 | # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" | |
437 | # fi | |
b761356f | 438 | done |
84aa13f4 | 439 | |
3dcdc1f9 | 440 | for arch in $(getarchitecturesfromcommalist "$ARCH"); do |
84aa13f4 DK |
441 | rm -rf ${BUILDDIR}/debian/tmp |
442 | mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin | |
443 | cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} | |
444 | cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch} | |
42c1513b MV |
445 | if [ -n "$FILE_TREE" ]; then |
446 | cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp | |
447 | fi | |
42c1513b | 448 | |
84aa13f4 DK |
449 | (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch) |
450 | (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) | |
846856f4 | 451 | local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" |
eb9dee96 DK |
452 | # ensure the right permissions as dpkg-deb ensists |
453 | chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN | |
adff049d | 454 | if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then |
846856f4 DK |
455 | cat $LOG |
456 | false | |
457 | fi | |
458 | rm $LOG | |
84aa13f4 DK |
459 | echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist |
460 | done | |
461 | ||
13845042 DK |
462 | mkdir -p ${BUILDDIR}/../${NAME}_${VERSION} |
463 | cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/ | |
464 | cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog | |
5a635ee4 | 465 | rm -rf "${BUILDDIR}" |
b761356f | 466 | msgdone "info" |
75954ae2 DK |
467 | } |
468 | ||
469 | buildpackage() { | |
470 | local BUILDDIR=$1 | |
471 | local RELEASE=$2 | |
472 | local SECTION=$3 | |
ea65d079 | 473 | local ARCH=$(getarchitecture $4) |
846856f4 DK |
474 | local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" |
475 | local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" | |
476 | msgninfo "Build package ${PKGNAME} for ${RELEASE} in ${SECTION}… " | |
75954ae2 DK |
477 | cd $BUILDDIR |
478 | if [ "$ARCH" = "all" ]; then | |
479 | ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" | |
480 | fi | |
846856f4 DK |
481 | if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then |
482 | cat $BUILDLOG | |
483 | false | |
484 | fi | |
485 | local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")" | |
486 | local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')" | |
ce9864a8 | 487 | cd - > /dev/null |
b7899b00 | 488 | for PKG in $PKGS; do |
75954ae2 | 489 | echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist |
b7899b00 DK |
490 | done |
491 | for SRC in $SRCS; do | |
75954ae2 | 492 | echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist |
b7899b00 | 493 | done |
cffea9af | 494 | msgdone "info" |
ce9864a8 DK |
495 | } |
496 | ||
497 | buildaptarchive() { | |
ce9864a8 | 498 | if [ -d incoming ]; then |
846856f4 | 499 | buildaptarchivefromincoming "$@" |
ce9864a8 | 500 | else |
846856f4 | 501 | buildaptarchivefromfiles "$@" |
ce9864a8 DK |
502 | fi |
503 | } | |
504 | ||
505 | createaptftparchiveconfig() { | |
276e51dd DK |
506 | local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')" |
507 | COMPRESSORS="${COMPRESSORS%* }" | |
ce9864a8 | 508 | 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 |
509 | if [ -z "$ARCHS" ]; then |
510 | # the pool is empty, so we will operate on faked packages - let us use the configured archs | |
53ea1b56 | 511 | ARCHS="$(getarchitectures)" |
158fda31 | 512 | fi |
ce9864a8 DK |
513 | echo -n 'Dir { |
514 | ArchiveDir "' >> ftparchive.conf | |
515 | echo -n $(readlink -f .) >> ftparchive.conf | |
516 | echo -n '"; | |
517 | CacheDir "' >> ftparchive.conf | |
518 | echo -n $(readlink -f ..) >> ftparchive.conf | |
519 | echo -n '"; | |
b7899b00 DK |
520 | FileListDir "' >> ftparchive.conf |
521 | echo -n $(readlink -f pool/) >> ftparchive.conf | |
522 | echo -n '"; | |
523 | }; | |
524 | Default { | |
276e51dd DK |
525 | Packages::Compress "'"$COMPRESSORS"'"; |
526 | Sources::Compress "'"$COMPRESSORS"'"; | |
527 | Contents::Compress "'"$COMPRESSORS"'"; | |
528 | Translation::Compress "'"$COMPRESSORS"'"; | |
18331adf | 529 | LongDescription "false"; |
ce9864a8 DK |
530 | }; |
531 | TreeDefault { | |
532 | Directory "pool/"; | |
533 | SrcDirectory "pool/"; | |
534 | }; | |
535 | APT { | |
536 | FTPArchive { | |
537 | Release { | |
538 | Origin "joesixpack"; | |
539 | Label "apttestcases"; | |
540 | Suite "unstable"; | |
541 | Description "repository with dummy packages"; | |
542 | Architectures "' >> ftparchive.conf | |
543 | echo -n "$ARCHS" >> ftparchive.conf | |
544 | echo 'source"; | |
545 | }; | |
546 | }; | |
547 | };' >> ftparchive.conf | |
b7899b00 DK |
548 | for DIST in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do |
549 | echo -n 'tree "dists/' >> ftparchive.conf | |
550 | echo -n "$DIST" >> ftparchive.conf | |
551 | echo -n '" { | |
ce9864a8 DK |
552 | Architectures "' >> ftparchive.conf |
553 | echo -n "$ARCHS" >> ftparchive.conf | |
b7899b00 DK |
554 | echo -n 'source"; |
555 | FileList "' >> ftparchive.conf | |
556 | echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf | |
557 | echo -n '"; | |
558 | SourceFileList "' >> ftparchive.conf | |
559 | echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf | |
560 | echo -n '"; | |
561 | Sections "' >> ftparchive.conf | |
562 | 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 | echo '"; | |
ce9864a8 | 564 | };' >> ftparchive.conf |
b7899b00 | 565 | done |
ce9864a8 DK |
566 | } |
567 | ||
568 | buildaptftparchivedirectorystructure() { | |
b7899b00 DK |
569 | local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" |
570 | for DIST in $DISTS; do | |
571 | local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" | |
572 | for SECTION in $SECTIONS; do | |
573 | local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" | |
574 | for ARCH in $ARCHS; do | |
575 | mkdir -p dists/${DIST}/${SECTION}/binary-${ARCH} | |
576 | done | |
577 | mkdir -p dists/${DIST}/${SECTION}/source | |
578 | mkdir -p dists/${DIST}/${SECTION}/i18n | |
579 | done | |
ce9864a8 | 580 | done |
ce9864a8 DK |
581 | } |
582 | ||
9b78cda6 DK |
583 | insertpackage() { |
584 | local RELEASE="$1" | |
585 | local NAME="$2" | |
586 | local ARCH="$3" | |
587 | local VERSION="$4" | |
588 | local DEPENDENCIES="$5" | |
d67004e0 | 589 | local PRIORITY="${6:-optional}" |
14109555 | 590 | local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} |
18908589 DK |
591 | If you find such a package installed on your system, |
592 | something went horribly wrong! They are autogenerated | |
593 | und used only by testcases and surf no other propose…"}" | |
d67004e0 | 594 | local ARCHS="" |
3dcdc1f9 | 595 | for arch in $(getarchitecturesfromcommalist "$ARCH"); do |
c919ad6e | 596 | if [ "$arch" = 'all' -o "$arch" = 'none' ]; then |
53ea1b56 | 597 | ARCHS="$(getarchitectures)" |
d67004e0 DK |
598 | else |
599 | ARCHS="$arch" | |
600 | fi | |
601 | for BUILDARCH in $ARCHS; do | |
602 | local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" | |
603 | mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source | |
604 | touch aptarchive/dists/${RELEASE}/main/source/Sources | |
605 | local FILE="${PPATH}/Packages" | |
606 | echo "Package: $NAME | |
607 | Priority: $PRIORITY | |
9b78cda6 | 608 | Section: other |
2c085486 | 609 | Installed-Size: 42 |
c919ad6e DK |
610 | Maintainer: Joe Sixpack <joe@example.org>" >> $FILE |
611 | test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE | |
612 | echo "Version: $VERSION | |
d67004e0 DK |
613 | Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE |
614 | test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE | |
18908589 | 615 | echo "Description: $DESCRIPTION" >> $FILE |
8ba17539 | 616 | echo >> $FILE |
d67004e0 | 617 | done |
9b78cda6 DK |
618 | done |
619 | } | |
620 | ||
234675b7 DK |
621 | insertsource() { |
622 | local RELEASE="$1" | |
623 | local NAME="$2" | |
624 | local ARCH="$3" | |
625 | local VERSION="$4" | |
626 | local DEPENDENCIES="$5" | |
627 | local ARCHS="" | |
628 | local SPATH="aptarchive/dists/${RELEASE}/main/source" | |
629 | mkdir -p $SPATH | |
630 | local FILE="${SPATH}/Sources" | |
631 | echo "Package: $NAME | |
632 | Binary: $NAME | |
633 | Version: $VERSION | |
634 | Maintainer: Joe Sixpack <joe@example.org> | |
635 | Architecture: $ARCH" >> $FILE | |
636 | test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE | |
637 | echo "Files: | |
638 | d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc | |
d5dea0be DK |
639 | d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz |
640 | " >> $FILE | |
234675b7 DK |
641 | } |
642 | ||
dfc2b1be DK |
643 | insertinstalledpackage() { |
644 | local NAME="$1" | |
645 | local ARCH="$2" | |
646 | local VERSION="$3" | |
647 | local DEPENDENCIES="$4" | |
d67004e0 | 648 | local PRIORITY="${5:-optional}" |
d4b4e5ea | 649 | local STATUS="${6:-install ok installed}" |
14109555 | 650 | local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed |
18908589 DK |
651 | If you find such a package installed on your system, |
652 | something went horribly wrong! They are autogenerated | |
653 | und used only by testcases and surf no other propose…"}" | |
654 | ||
53ea1b56 DK |
655 | local FILE='rootdir/var/lib/dpkg/status' |
656 | local INFO='rootdir/var/lib/dpkg/info' | |
3dcdc1f9 | 657 | for arch in $(getarchitecturesfromcommalist "$ARCH"); do |
d67004e0 | 658 | echo "Package: $NAME |
d4b4e5ea | 659 | Status: $STATUS |
d67004e0 | 660 | Priority: $PRIORITY |
dfc2b1be DK |
661 | Section: other |
662 | Installed-Size: 42 | |
663 | Maintainer: Joe Sixpack <joe@example.org> | |
dfc2b1be | 664 | Version: $VERSION" >> $FILE |
c919ad6e | 665 | test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE |
d67004e0 | 666 | test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE |
18908589 DK |
667 | echo "Description: $DESCRIPTION" >> $FILE |
668 | echo >> $FILE | |
53ea1b56 DK |
669 | if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then |
670 | echo -n > ${INFO}/${NAME}:${arch}.list | |
671 | else | |
672 | echo -n > ${INFO}/${NAME}.list | |
673 | fi | |
d67004e0 | 674 | done |
dfc2b1be DK |
675 | } |
676 | ||
677 | ||
ce9864a8 | 678 | buildaptarchivefromincoming() { |
3cbbda3c | 679 | msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…" |
ce9864a8 DK |
680 | cd aptarchive |
681 | [ -e pool ] || ln -s ../incoming pool | |
682 | [ -e ftparchive.conf ] || createaptftparchiveconfig | |
683 | [ -e dists ] || buildaptftparchivedirectorystructure | |
b7899b00 | 684 | msgninfo "\tGenerate Packages, Sources and Contents files… " |
ce9864a8 | 685 | aptftparchive -qq generate ftparchive.conf |
ce9864a8 DK |
686 | cd - > /dev/null |
687 | msgdone "info" | |
9b78cda6 | 688 | generatereleasefiles |
ce9864a8 DK |
689 | } |
690 | ||
691 | buildaptarchivefromfiles() { | |
3cbbda3c | 692 | msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" |
9b78cda6 DK |
693 | find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do |
694 | msgninfo "\t${line} file… " | |
276e51dd | 695 | compressfile "$line" "$1" |
8d876415 | 696 | msgdone "info" |
9b78cda6 | 697 | done |
e3c62328 | 698 | generatereleasefiles "$@" |
9b78cda6 DK |
699 | } |
700 | ||
276e51dd DK |
701 | compressfile() { |
702 | cat ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | while read compressor extension command; do | |
703 | if [ "$compressor" = '.' ]; then | |
704 | if [ -n "$2" ]; then | |
705 | touch -d "$2" "$1" | |
706 | fi | |
707 | continue | |
708 | fi | |
709 | cat "$1" | $command > "${1}.${extension}" | |
710 | if [ -n "$2" ]; then | |
711 | touch -d "$2" "${1}.${extension}" | |
712 | fi | |
713 | done | |
714 | } | |
715 | ||
a3bbbab7 | 716 | # can be overridden by testcases for their pleasure |
bf9e7447 DK |
717 | getcodenamefromsuite() { |
718 | case "$1" in | |
719 | unstable) echo 'sid';; | |
720 | *) echo -n "$1";; | |
721 | esac | |
722 | } | |
a3bbbab7 | 723 | getreleaseversionfromsuite() { true; } |
718f797c | 724 | getlabelfromsuite() { true; } |
a3bbbab7 | 725 | |
9b78cda6 | 726 | generatereleasefiles() { |
884a4c0a DK |
727 | # $1 is the Date header and $2 is the ValidUntil header to be set |
728 | # both should be given in notation date/touch can understand | |
9b78cda6 DK |
729 | msgninfo "\tGenerate Release files… " |
730 | if [ -e aptarchive/dists ]; then | |
731 | for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do | |
a3bbbab7 DK |
732 | local SUITE="$(echo "$dir" | cut -d'/' -f 4)" |
733 | local CODENAME="$(getcodenamefromsuite $SUITE)" | |
734 | local VERSION="$(getreleaseversionfromsuite $SUITE)" | |
718f797c | 735 | local LABEL="$(getlabelfromsuite $SUITE)" |
884a4c0a | 736 | if [ -n "$VERSION" ]; then |
718f797c DK |
737 | VERSION="-o APT::FTPArchive::Release::Version=${VERSION}" |
738 | fi | |
739 | if [ -n "$LABEL" ]; then | |
740 | LABEL="-o APT::FTPArchive::Release::Label=${LABEL}" | |
a3bbbab7 | 741 | fi |
884a4c0a DK |
742 | aptftparchive -qq release $dir \ |
743 | -o APT::FTPArchive::Release::Suite="${SUITE}" \ | |
744 | -o APT::FTPArchive::Release::Codename="${CODENAME}" \ | |
718f797c | 745 | ${LABEL} \ |
884a4c0a DK |
746 | ${VERSION} \ |
747 | | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference | |
a3bbbab7 | 748 | if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then |
35faae11 DK |
749 | sed -i '/^Date: / a\ |
750 | NotAutomatic: yes' $dir/Release | |
751 | fi | |
884a4c0a DK |
752 | if [ -n "$1" -a "$1" != "now" ]; then |
753 | sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release | |
754 | fi | |
755 | if [ -n "$2" ]; then | |
756 | sed -i "/^Date: / a\ | |
757 | Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release | |
758 | fi | |
9b78cda6 DK |
759 | done |
760 | else | |
761 | aptftparchive -qq release ./aptarchive | sed -e '/0 Release$/ d' > aptarchive/Release # remove the self reference | |
8d876415 | 762 | fi |
884a4c0a | 763 | if [ -n "$1" -a "$1" != "now" ]; then |
fe0f7911 DK |
764 | for release in $(find ./aptarchive -name 'Release'); do |
765 | touch -d "$1" $release | |
766 | done | |
8d876415 | 767 | fi |
b7899b00 | 768 | msgdone "info" |
8d876415 DK |
769 | } |
770 | ||
b7899b00 DK |
771 | setupdistsaptarchive() { |
772 | local APTARCHIVE=$(readlink -f ./aptarchive) | |
773 | rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list | |
774 | rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list | |
775 | for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do | |
776 | SECTIONS=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') | |
777 | msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " | |
778 | echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list | |
779 | echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list | |
780 | msgdone "info" | |
781 | done | |
782 | } | |
783 | ||
784 | setupflataptarchive() { | |
ce9864a8 | 785 | local APTARCHIVE=$(readlink -f ./aptarchive) |
8d876415 DK |
786 | if [ -f ${APTARCHIVE}/Packages ]; then |
787 | msgninfo "\tadd deb sources.list line… " | |
788 | echo "deb file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list | |
789 | msgdone "info" | |
790 | else | |
791 | rm -f rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list | |
792 | fi | |
793 | if [ -f ${APTARCHIVE}/Sources ]; then | |
794 | msgninfo "\tadd deb-src sources.list line… " | |
795 | echo "deb-src file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list | |
796 | msgdone "info" | |
797 | else | |
798 | rm -f rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list | |
799 | fi | |
b7899b00 DK |
800 | } |
801 | ||
802 | setupaptarchive() { | |
803 | buildaptarchive | |
804 | if [ -e aptarchive/dists ]; then | |
805 | setupdistsaptarchive | |
806 | else | |
807 | setupflataptarchive | |
808 | fi | |
f213b6ea | 809 | signreleasefiles |
b2ea1a47 DK |
810 | if [ "$1" != '--no-update' ]; then |
811 | msgninfo "\tSync APT's cache with the archive… " | |
812 | aptget update -qq | |
813 | msgdone "info" | |
814 | fi | |
8d876415 DK |
815 | } |
816 | ||
f213b6ea DK |
817 | signreleasefiles() { |
818 | local SIGNER="${1:-Joe Sixpack}" | |
77a45beb | 819 | local GPG="gpg --batch --yes" |
f213b6ea | 820 | msgninfo "\tSign archive with $SIGNER key… " |
29a59c46 DK |
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 | |
835 | else | |
836 | printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub --secret-keyring ${REXKEY}.sec --command-fd 0 --edit-key "${SIGNER}" >/dev/null 2>&1 || true | |
837 | cp ${REXKEY}.sec $SECUNEXPIRED | |
838 | cp ${REXKEY}.pub $PUBUNEXPIRED | |
839 | fi | |
840 | fi | |
f213b6ea | 841 | for KEY in $(find keys/ -name '*.sec'); do |
29a59c46 | 842 | GPG="$GPG --secret-keyring $KEY" |
f213b6ea | 843 | done |
f213b6ea | 844 | for KEY in $(find keys/ -name '*.pub'); do |
29a59c46 | 845 | GPG="$GPG --keyring $KEY" |
f213b6ea DK |
846 | done |
847 | for RELEASE in $(find aptarchive/ -name Release); do | |
29a59c46 | 848 | $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE} |
e3c62328 | 849 | local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" |
29a59c46 | 850 | $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE |
e3c62328 DK |
851 | # we might have set a specific date for the Release file, so copy it |
852 | touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg ${INRELEASE} | |
f213b6ea | 853 | done |
29a59c46 DK |
854 | if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then |
855 | mv -f $SECEXPIREBAK ${REXKEY}.sec | |
856 | mv -f $PUBEXPIREBAK ${REXKEY}.pub | |
857 | fi | |
f213b6ea DK |
858 | msgdone "info" |
859 | } | |
860 | ||
f2c0ec8b DK |
861 | webserverconfig() { |
862 | msgtest "Set webserver config option '${1}' to" "$2" | |
0d58c26a DK |
863 | local DOWNLOG='rootdir/tmp/download-testfile.log' |
864 | local STATUS='rootdir/tmp/webserverconfig.status' | |
865 | rm -f "$STATUS" "$DOWNLOG" | |
866 | if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then | |
f2c0ec8b DK |
867 | msgpass |
868 | else | |
0d58c26a DK |
869 | cat "$DOWNLOG" "$STATUS" |
870 | msgfail | |
f2c0ec8b | 871 | fi |
0d58c26a | 872 | testwebserverlaststatuscode '200' |
f2c0ec8b DK |
873 | } |
874 | ||
fd46d305 DK |
875 | rewritesourceslist() { |
876 | local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")" | |
877 | for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do | |
878 | sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#" | |
879 | done | |
880 | } | |
881 | ||
5572f6bd MV |
882 | # wait for up to 10s for a pid file to appear to avoid possible race |
883 | # when a helper is started and dosn't write the PID quick enough | |
884 | waitforpidfile() { | |
885 | local PIDFILE="$1" | |
886 | for i in $(seq 10); do | |
887 | if test -s "$PIDFILE"; then | |
888 | return 0 | |
889 | fi | |
890 | sleep 1 | |
891 | done | |
892 | msgdie "waiting for $PIDFILE failed" | |
893 | return 1 | |
894 | } | |
895 | ||
f213b6ea | 896 | changetowebserver() { |
23af9f40 DK |
897 | if [ "$1" != '--no-rewrite' ]; then |
898 | rewritesourceslist 'http://localhost:8080/' | |
899 | else | |
900 | shift | |
901 | fi | |
5c0dd6fc | 902 | if test -x ${APTWEBSERVERBINDIR}/aptwebserver; then |
fbd29dd6 | 903 | cd aptarchive |
a0db467c DK |
904 | local LOG="webserver.log" |
905 | if ! aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 ; then | |
bee0670b DK |
906 | cat $LOG |
907 | false | |
908 | fi | |
5572f6bd | 909 | waitforpidfile aptwebserver.pid |
e3c62328 DK |
910 | local PID="$(cat aptwebserver.pid)" |
911 | if [ -z "$PID" ]; then | |
912 | msgdie 'Could not fork aptwebserver successfully' | |
913 | fi | |
914 | addtrap "kill $PID;" | |
fbd29dd6 | 915 | cd - > /dev/null |
c5bcc607 | 916 | else |
fbd29dd6 | 917 | msgdie 'You have to build aptwerbserver or install a webserver' |
f213b6ea | 918 | fi |
fd46d305 DK |
919 | } |
920 | ||
921 | changetohttpswebserver() { | |
922 | if ! which stunnel4 >/dev/null; then | |
923 | msgdie 'You need to install stunnel4 for https testcases' | |
924 | fi | |
925 | if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then | |
dc95fee1 | 926 | changetowebserver --no-rewrite "$@" |
fd46d305 DK |
927 | fi |
928 | echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid | |
929 | cert = ${TESTDIRECTORY}/apt.pem | |
23af9f40 | 930 | output = /dev/null |
fd46d305 DK |
931 | |
932 | [https] | |
933 | accept = 4433 | |
934 | connect = 8080 | |
935 | " > ${TMPWORKINGDIRECTORY}/stunnel.conf | |
936 | stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" | |
5572f6bd | 937 | waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" |
fd46d305 | 938 | local PID="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)" |
5572f6bd MV |
939 | if [ -z "$PID" ]; then |
940 | msgdie 'Could not fork stunnel4 successfully' | |
941 | fi | |
fd46d305 DK |
942 | addtrap 'prefix' "kill ${PID};" |
943 | rewritesourceslist 'https://localhost:4433/' | |
f213b6ea DK |
944 | } |
945 | ||
c45233ea DK |
946 | changetocdrom() { |
947 | mkdir -p rootdir/media/cdrom/.disk | |
948 | local CD="$(readlink -f rootdir/media/cdrom)" | |
a0975c8d DK |
949 | echo "acquire::cdrom::mount \"${CD}\"; |
950 | acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\"; | |
951 | acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\"; | |
952 | acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom | |
c45233ea DK |
953 | echo -n "$1" > ${CD}/.disk/info |
954 | if [ ! -d aptarchive/dists ]; then | |
955 | msgdie 'Flat file archive cdroms can not be created currently' | |
956 | return 1 | |
957 | fi | |
a0975c8d | 958 | mv aptarchive/dists "$CD" |
c45233ea DK |
959 | ln -s "$(readlink -f ./incoming)" $CD/pool |
960 | find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete | |
a0975c8d DK |
961 | # start with an unmounted disk |
962 | mv "${CD}" "${CD}-unmounted" | |
963 | # we don't want the disk to be modifiable | |
964 | addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;" | |
965 | chmod -R -w rootdir/media/cdrom-unmounted/dists | |
c45233ea DK |
966 | } |
967 | ||
fd46d305 | 968 | downloadfile() { |
0d58c26a | 969 | local PROTO="$(echo "$1" | cut -d':' -f 1 )" |
3dcdc1f9 | 970 | apthelper -o Debug::Acquire::${PROTO}=1 \ |
0d58c26a | 971 | download-file "$1" "$2" 2>&1 || true |
fd46d305 DK |
972 | # only if the file exists the download was successful |
973 | if [ -e "$2" ]; then | |
974 | return 0 | |
975 | else | |
976 | return 1 | |
977 | fi | |
978 | } | |
979 | ||
f213b6ea | 980 | checkdiff() { |
846856f4 | 981 | local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" |
8d876415 | 982 | if [ -n "$DIFFTEXT" ]; then |
0d58c26a DK |
983 | echo >&2 |
984 | echo >&2 "$DIFFTEXT" | |
8d876415 DK |
985 | return 1 |
986 | else | |
987 | return 0 | |
988 | fi | |
989 | } | |
990 | ||
75954ae2 DK |
991 | testfileequal() { |
992 | local FILE="$1" | |
993 | shift | |
994 | msgtest "Test for correctness of file" "$FILE" | |
995 | if [ -z "$*" ]; then | |
f213b6ea | 996 | echo -n "" | checkdiff $FILE - && msgpass || msgfail |
75954ae2 | 997 | else |
f213b6ea | 998 | echo "$*" | checkdiff $FILE - && msgpass || msgfail |
75954ae2 DK |
999 | fi |
1000 | } | |
1001 | ||
b855a400 DK |
1002 | testempty() { |
1003 | msgtest "Test for no output of" "$*" | |
1004 | test -z "$($* 2>&1)" && msgpass || msgfail | |
1005 | } | |
1006 | ||
f74a6fa1 DK |
1007 | testequal() { |
1008 | local MSG='Test of equality of' | |
1009 | if [ "$1" = '--nomsg' ]; then | |
1010 | MSG='' | |
1011 | shift | |
1012 | fi | |
1013 | ||
03938280 | 1014 | local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" |
8d876415 DK |
1015 | echo "$1" > $COMPAREFILE |
1016 | shift | |
d2d68aaf | 1017 | |
f74a6fa1 DK |
1018 | if [ -n "$MSG" ]; then |
1019 | msgtest "$MSG" "$*" | |
1020 | fi | |
1021 | $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail | |
8d876415 DK |
1022 | } |
1023 | ||
685625bd | 1024 | testequalor2() { |
03938280 DK |
1025 | local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" |
1026 | local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" | |
1027 | local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" | |
685625bd DK |
1028 | echo "$1" > $COMPAREFILE1 |
1029 | echo "$2" > $COMPAREFILE2 | |
1030 | shift 2 | |
1031 | msgtest "Test for equality OR of" "$*" | |
18908589 | 1032 | $* >$COMPAREAGAINST 2>&1 || true |
0d58c26a DK |
1033 | if checkdiff $COMPAREFILE1 $COMPAREAGAINST >/dev/null 2>&1 || \ |
1034 | checkdiff $COMPAREFILE2 $COMPAREAGAINST >/dev/null 2>&1 | |
1035 | then | |
0caa5a4c DK |
1036 | msgpass |
1037 | else | |
1038 | echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" | |
1039 | checkdiff $COMPAREFILE1 $COMPAREAGAINST || true | |
1040 | echo -n "${CINFO}Diff against OR 2${CNORMAL}" | |
1041 | checkdiff $COMPAREFILE2 $COMPAREAGAINST || true | |
1042 | msgfail | |
1043 | fi | |
685625bd DK |
1044 | } |
1045 | ||
8d876415 | 1046 | testshowvirtual() { |
edc0ef10 | 1047 | local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" |
8d876415 DK |
1048 | local PACKAGE="$1" |
1049 | shift | |
1050 | while [ -n "$1" ]; do | |
1051 | VIRTUAL="${VIRTUAL} | |
edc0ef10 | 1052 | N: Can't select versions from package '$1' as it is purely virtual" |
8d876415 DK |
1053 | PACKAGE="${PACKAGE} $1" |
1054 | shift | |
1055 | done | |
1056 | msgtest "Test for virtual packages" "apt-cache show $PACKAGE" | |
1057 | VIRTUAL="${VIRTUAL} | |
4bec02c2 | 1058 | N: No packages found" |
03938280 | 1059 | local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" |
ea65d079 | 1060 | local ARCH="$(getarchitecture 'native')" |
8d876415 | 1061 | echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE |
e8379ba3 | 1062 | aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail |
8d876415 DK |
1063 | } |
1064 | ||
1065 | testnopackage() { | |
1066 | msgtest "Test for non-existent packages" "apt-cache show $*" | |
846856f4 | 1067 | local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" |
8d876415 | 1068 | if [ -n "$SHOWPKG" ]; then |
0d58c26a DK |
1069 | echo >&2 |
1070 | echo >&2 "$SHOWPKG" | |
8d876415 | 1071 | msgfail |
0d58c26a DK |
1072 | else |
1073 | msgpass | |
8d876415 | 1074 | fi |
8d876415 | 1075 | } |
01a6e24c DK |
1076 | |
1077 | testdpkginstalled() { | |
1078 | msgtest "Test for correctly installed package(s) with" "dpkg -l $*" | |
846856f4 | 1079 | local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)" |
87bc1c45 | 1080 | if [ "$PKGS" != $# ]; then |
0d58c26a DK |
1081 | echo >&2 $PKGS |
1082 | dpkg -l "$@" | grep '^[a-z]' >&2 | |
01a6e24c | 1083 | msgfail |
0d58c26a DK |
1084 | else |
1085 | msgpass | |
01a6e24c | 1086 | fi |
01a6e24c DK |
1087 | } |
1088 | ||
5cf733e1 DK |
1089 | testdpkgnotinstalled() { |
1090 | msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*" | |
846856f4 | 1091 | local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" |
01a6e24c DK |
1092 | if [ "$PKGS" != 0 ]; then |
1093 | echo | |
0d58c26a | 1094 | dpkg -l "$@" | grep '^[a-z]' >&2 |
01a6e24c | 1095 | msgfail |
0d58c26a DK |
1096 | else |
1097 | msgpass | |
01a6e24c | 1098 | fi |
01a6e24c | 1099 | } |
ec7f904e DK |
1100 | |
1101 | testmarkedauto() { | |
03938280 | 1102 | local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" |
ec7f904e DK |
1103 | if [ -n "$1" ]; then |
1104 | msgtest 'Test for correctly marked as auto-installed' "$*" | |
1105 | while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE | |
1106 | else | |
1107 | msgtest 'Test for correctly marked as auto-installed' 'no package' | |
c98fb5e0 | 1108 | echo -n > $COMPAREFILE |
ec7f904e DK |
1109 | fi |
1110 | aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail | |
1111 | } | |
89a1aa5d | 1112 | |
0440d936 DK |
1113 | testsuccess() { |
1114 | if [ "$1" = '--nomsg' ]; then | |
1115 | shift | |
1116 | else | |
1117 | msgtest 'Test for successful execution of' "$*" | |
1118 | fi | |
03938280 | 1119 | local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" |
0440d936 DK |
1120 | if $@ >${OUTPUT} 2>&1; then |
1121 | msgpass | |
1122 | else | |
0d58c26a DK |
1123 | echo >&2 |
1124 | cat >&2 $OUTPUT | |
0440d936 DK |
1125 | msgfail |
1126 | fi | |
1127 | } | |
1128 | ||
1129 | testfailure() { | |
1130 | if [ "$1" = '--nomsg' ]; then | |
1131 | shift | |
1132 | else | |
889b0072 | 1133 | msgtest 'Test for failure in execution of' "$*" |
0440d936 | 1134 | fi |
03938280 | 1135 | local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" |
0440d936 | 1136 | if $@ >${OUTPUT} 2>&1; then |
0d58c26a DK |
1137 | echo >&2 |
1138 | cat >&2 $OUTPUT | |
0440d936 DK |
1139 | msgfail |
1140 | else | |
1141 | msgpass | |
1142 | fi | |
1143 | } | |
1144 | ||
0d58c26a DK |
1145 | testwebserverlaststatuscode() { |
1146 | local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' | |
1147 | local STATUS='rootdir/tmp/webserverstatus-statusfile.log' | |
1148 | rm -f "$DOWNLOG" "$STATUS" | |
1149 | msgtest 'Test last status code from the webserver was' "$1" | |
1150 | downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" | |
1151 | if [ "$(cat "$STATUS")" = "$1" ]; then | |
1152 | msgpass | |
1153 | else | |
1154 | echo >&2 | |
1155 | if [ -n "$2" ]; then | |
1156 | shift | |
1157 | echo >&2 '#### Additionally provided output files contain:' | |
1158 | cat >&2 "$@" | |
1159 | fi | |
1160 | echo >&2 '#### Download log of the status code:' | |
1161 | cat >&2 "$DOWNLOG" | |
1162 | msgfail "Status was $(cat "$STATUS")" | |
1163 | fi | |
1164 | } | |
1165 | ||
89a1aa5d DK |
1166 | pause() { |
1167 | echo "STOPPED execution. Press enter to continue" | |
1168 | local IGNORE | |
1169 | read IGNORE | |
1170 | } |